我在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];
}
}
}
}
答案 0 :(得分:0)
哟必须检查你的viewcontroller是否为零。