UIImagePickerController 未在 iOS 9 中选取图像 [英] UIImagePickerController not picking image in iOS 9

查看:28
本文介绍了UIImagePickerController 未在 iOS 9 中选取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码从相机或照片库中选择图像.在 iOS 8 中,它可以很好地选择图像.但在 iOS 9 中.选择器视图显示但不选择图像.甚至没有回到控制器.点击图片没有任何作用.我究竟做错了什么.

I am using the below code to select image from Camera or Photo Library. In iOS 8, it is picking image nicely. But in iOS 9 . picker view displayed but not selecting image. Not even go back to the controller. Tap on picture does nothing. What am i doing wrong.

- (void)showImgaePickerViewForSourceType:(UIImagePickerControllerSourceType)sourceType
{
    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
    imagePickerController.sourceType = sourceType;
    imagePickerController.allowsEditing = YES;
    imagePickerController.delegate = self;
    self.imgPickerController = imagePickerController;

    if (IS_IPAD) {
        [[NSOperationQueue mainQueue] addOperationWithBlock:^{
            UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:self.imgPickerController];
            [popover presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2-200, self.view.frame.size.height/2 - 300, 400, 400) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
            self.popOver = popover;
        }];
    }else{
             [self presentViewController:self.imgPickerController animated:YES completion:NULL];
    }
}

推荐答案

我发现我的应用在其他 iPhone(无论是 iOS 8 还是 iOS 9)上运行良好.我无法从任何其他应用程序中选择图像.然后我决定重置我的 iPhone.现在一切都很完美.不是代码问题.这是我的 iPhone 问题.

I found that my app was running good on other iPhones(whether iOS 8 or iOS 9). I was not able to pick image from any other app. Then i decided to reset my iPhone. Now everything is perfect. It was'nt the code issue. It was my iPhone issue.

这篇关于UIImagePickerController 未在 iOS 9 中选取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆