iCloud文档选择器:导入时禁用应用程序文件夹

时间:2015-12-16 08:10:11

标签: ios objective-c xcode icloud uidocumentpickervc

我在尝试从iCloud导入时遇到有关禁用应用文件夹的问题,请参阅下图:

My App iCloud import

我检查了谷歌驱动器的iCloud导入,并且它没有被禁用,如下图所示:

Google Drive iCloud import

我需要从其他应用程序的文件夹中获取文档,我做错了什么?

这是我在info.plist中的当前设置:

My info.plist

代码:

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

documentPicker.delegate = self;

documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;

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

1 个答案:

答案 0 :(得分:1)

您需要在UIDocumentPickerViewController中添加Utils

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];