
[英][ActionSheetPicker respondsToSelector:]: message sent to deallocated instance
[英]-[UIImagePickerController respondsToSelector:]: message sent to deallocated instance in iOS
我使用UIImagePickerController捕获了来自Camera的真实照片。 它曾经可以工作,但是在iOS8上我面临崩溃。 下面是代码和崩溃日志。
UIImagePickerController *imagePicker =
[[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.allowsEditing = NO;
[self.navigationController presentViewController:imagePicker animated:YES completion:nil];
- (void)imagePickerControllerDidCancel:(UIImagePickerController *) Picker {
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
日志:快照未渲染的视图将导致快照为空。 确保在快照之前或屏幕更新后快照至少已渲染一次视图。
-[UIImagePickerController responsesToSelector:]:发送到已释放实例的消息
重现此问题的步骤是,1.在App中单击“相机”按钮。 2.相机打开。 3.单击“ Camera UI”上的“ Cancel”。 4.再次单击相机按钮,应用程序立即崩溃。
您应该使用[self presentViewController:imagePicker动画:是完成:无];
和[self dismissViewControllerAnimated:YES完成:无];
我面临着同样的问题。 我通过以下两种方法在动画参数中传递“ NO
”来解决此问题:
[self presentViewController:imagePickerController animated:NO completion:nil];
[self dismissViewControllerAnimated:NO completion:nil];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.