为什么照片应用程序未显示在设备上的文档提供程序扩展中?

时间:2015-10-14 13:51:34

标签: ios ios-app-extension uidocumentpickervc document-provider

我在app中工作以选择照片,我使用UIDocumentMenuViewController来显示文档提供者的扩展名列表。此列表显示Dropbox,iCloud,GoogleDrive但不是原生照片应用,为什么? 我的代码示例:

UIDocumentMenuViewController *menuVC = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:@[@"public.image"] inMode:UIDocumentPickerModeImport];

enter image description here

1 个答案:

答案 0 :(得分:10)

我不确定本机是否还有其他办法可以做到这一点,但我想出了一个解决方案来添加一个带处理程序的自定义选项。我添加了"照片"选项,在处理程序中我使用UIImagePickerViewController

 UIDocumentMenuViewController *menuVC = [[UIDocumentMenuViewController alloc] initWithDocumentTypes:UTIs inMode:UIDocumentPickerModeImport];


    [menuVC addOptionWithTitle:@"Photos" image:nil order:UIDocumentMenuOrderFirst handler:^{

        UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];

        imagePickerController.delegate = self;
        [self presentViewController:imagePickerController animated:YES completion:nil];
    }];

我会这样做并为" Camera"。

添加另一个选项