我仅在 iOS 8.3 中无法访问我的 iPad 的照片和摄像机。iPhone代码没有问题。而且,此代码适用于 iOS 7 中的两种设备。目前不知道为什么会这样。当弹出窗口发生时,我选择“选择现有照片或视频”,没有其他任何反应。我确实设置了允许照片/视频库访问的应用程序权限。这是我的代码示例。有人有类似的问题吗?
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex != 2) {
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.allowsEditing = NO;
imagePickerController.delegate = self;
if (buttonIndex == 0) {
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:imagePickerController animated:YES completion:nil];
} else {
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
popover = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
[popover presentPopoverFromRect:CGRectMake(54.0f, 120.0f, 660.0f, 380.0f) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
} else {
[self presentViewController:imagePickerController animated:YES completion:nil];
}
}
}
}