I'm trying to use the iOS 14 initForOpeningContentTypes: rather than the deprecated initWithDocumentTypes:inMode:
and I'm unable to get access to files with the extension p8
(they are greyed out).
I'm trying the following code:
NSArray<UTType*> * contentTypes = @[[UTType typeWithFilenameExtension: @"p8"
conformingToType: UTTypeData]];
UIDocumentPickerViewController *documentPicker = nil;
documentPicker = [[UIDocumentPickerViewController alloc] initForOpeningContentTypes: contentTypes];
The picker launches, but the file "myfile.p8" is greyed out and unselectable. What am I doing wrong here?
Once I added the following to my application’s Info.plist I was able to select the file:
Apparently it tells the system about the type. See this answer for info about
UTExportedTypeDeclarations
.