【发布时间】:2014-09-16 12:20:46
【问题描述】:
还有其他人在 iOS 8 中遇到UIImagePickerController 的问题吗?下面的方法在 iPad 上的 iOS 7 中运行良好,但是当我在 XCode 6(Beta 3 或 4)中运行该方法时,当我尝试显示选择器(最后一行)时,会出现以下错误。如果重要的话,sourceType 的选择来自于显示在同一位置的 alertView。
Warning: Attempt to present <UIImagePickerController: 0x7c0ae400> on <CAGUCreateContactViewController: 0x7bf61a00> which is already presenting (null)
打开imagePicker的方法。
- (void)openPhotoPicker:(UIImagePickerControllerSourceType)sourceType
{
if ([UIImagePickerController isSourceTypeAvailable:sourceType]) {
NSArray *availableMediaTypes = [UIImagePickerController availableMediaTypesForSourceType:sourceType];
if ([availableMediaTypes containsObject:(NSString *)kUTTypeImage]) {
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;
imagePickerController.sourceType = sourceType;
imagePickerController.mediaTypes = @[(NSString *)kUTTypeImage];
imagePickerController.delegate = self;
self.imagePickerController = imagePickerController;
if (sourceType == UIImagePickerControllerSourceTypeCamera) {
[self presentViewController:self.imagePickerController animated:YES completion:nil];
} else {
if (self.popoverVC) {
[self.popoverVC dismissPopoverAnimated:YES];
self.popoverVC = nil;
}
self.popoverVC = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
[self.popoverVC presentPopoverFromRect:self.nameAndPicCell.picture.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
}
}
}
【问题讨论】:
-
目前还没有;选择器实际显示,但我仍然在控制台中收到错误。
-
在 iOS 9 及更高版本中工作正常。
标签: ios ipad uiimagepickercontroller ios8