问题
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