Search code examples
iosobjective-cxcodeiclouduidocumentpickervc

iCloud Document Picker: App folders are disabled on import


I'm having a problem regarding app folders being disabled when I'm trying to import from iCloud, see the image below:

My App iCloud import

I checked google drive's iCloud import and it's not disabled like in the image below:

Google Drive iCloud import

I need to get documents from other app's folder, what did I do wrong?

This is my current setup in my info.plist:

My info.plist

Code:

UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.item"] 
                  inMode:UIDocumentPickerModeImport];

documentPicker.delegate = self;

documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;

[self presentViewController:documentPicker animated:YES completion:nil];

Solution

  • You need to add the Utils in UIDocumentPickerViewController

    UIDocumentPickerViewController *picker=[[UIDocumentPickerViewController alloc] 
          initWithDocumentTypes: @[(__bridge NSString *) kUTTypeContent,
                                   (__bridge NSString *) kUTTypeData,
                                   (__bridge NSString *) kUTTypePackage,
                                   (__bridge NSString *) kUTTypeDiskImage,
                                   @"com.apple.iwork.pages.pages",
                                   @"com.apple.iwork.numbers.numbers",
                                   @"com.apple.iwork.keynote.key"] inMode:UIDocumentPickerModeImport];