UIImagePickerController takePicture没有响应 [英] UIImagePickerController takePicture not responding

查看:72
本文介绍了UIImagePickerController takePicture没有响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我初始化UIImagePickerController:

I init the UIImagePickerController:

    imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = self;
    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;

,然后使用此方法 [imagePicker takePicture];

而且我没有收到任何对委托方法的调用:

and I not get any call to the delegate method:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

知道为什么吗?

推荐答案

您没有提到是否实际上是通过调用 -presentViewController:animated:completion:(或较旧的 presentViewController:animated:).

You don't mention if you're actually presenting the image picker controller to the user by calling -presentViewController:animated:completion: (or the older presentViewController:animated:).

Apple的文档没有明确说明,但我很确定需要在屏幕上显示图像选择器控制器,以使 -takePicture 正常工作,否则您将能够图片,而用户不知道.

Apple's docs don't explicitly say so, but I'm pretty sure the image picker controller needs to be shown on screen in order for -takePicture to work, otherwise you would be able to take pictures without the user knowing.

这篇关于UIImagePickerController takePicture没有响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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