Search code examples
iosswifticloud

UIDocumentPickerViewController not showing all files


I'm writing an iOS app, and I would like to be able to view all of the files in iCloud drive. I've setup a UIDocumentPickerViewController with the following array of UTIs:

["\(kUTTypeContent)","\(kUTTypeData)","\(kUTTypeItem)"]

However, some types aren't showing, like iWork documents. iWork conforms to public.package, which conforms at the top to public.item. Do I need to declare all of the file UTIs individually? I've tried with PDFs, and they work fine.


Solution

  • There is a bug in iOS8 with iWork files, as workaround you can specify iWork's UTIs individually. Sample code from my category:

    + (NSArray *)fp_supportedDocumentTypes {
        return @[(__bridge NSString *) kUTTypeContent,
                (__bridge NSString *) kUTTypeData,
                (__bridge NSString *) kUTTypePackage,
                NL(@"com.apple.iwork.pages.pages"),
                NL(@"com.apple.iwork.numbers.numbers"),
                NL(@"com.apple.iwork.keynote.key")];
    }