Why Photos app is NOT showing in the Document Provider extensions on the device?

这一生的挚爱 提交于 2019-12-22 10:26:35

问题


I'm working in app to pick photo, I have used UIDocumentMenuViewController to display list of extensions for document provider. This list shows Dropbox, iCloud, GoogleDrive but not the native Photos app, why? Sample of my code:

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


回答1:


I'm not sure if there is another way natively to do this, but I came up with a solution to add a custom option with handler. I added "Photos" option and in the handler I use 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];
    }];

I will do the same and add another option for "Camera".



来源:https://stackoverflow.com/questions/33127225/why-photos-app-is-not-showing-in-the-document-provider-extensions-on-the-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!