相关疑难解决方法(0)

UIImagePickerController错误:在iOS 7中快照未呈现的视图会导致空快照

我只在iOS 7中收到此错误并且应用程序崩溃了.在iOS 6中,我从未收到任何错误,只是在打开相机时出现内存警告.

Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
Run Code Online (Sandbox Code Playgroud)

这就是我在做的事情.

imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setDelegate:self];
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[imagePicker setAllowsEditing:YES];

[self presentModalViewController:imagePicker animated:YES];
Run Code Online (Sandbox Code Playgroud)

我确实试图延迟presentModalViewController,但我仍然得到相同的消息.几秒钟后(7-10),应用程序崩溃了.

此错误仅出现在iOS 7中.

有人有线索吗?先感谢您.

iphone camera uiimagepickercontroller ios ios7

103
推荐指数
4
解决办法
7万
查看次数

ios 10对未渲染的视图进行快照会导致快照为空

这个问题再问一次,但我找不到ios 10

if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera)
 {
            self.imagePicker.delegate = self
            self.imagePicker.sourceType = UIImagePickerControllerSourceType.camera;
            self.imagePicker.allowsEditing = false
            self.imagePicker.cameraCaptureMode = .photo
            //self.imagePicker.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
            self.present(self.imagePicker, animated: true, completion: nil)
            self.imagePicked.isUserInteractionEnabled = true

 }
else
 {
            print("No Camera")
 }
Run Code Online (Sandbox Code Playgroud)

对未渲染的视图进行快照会导致快照为空。请确保在快照之前至少对视图进行一次渲染或在屏幕更新后进行快照。

当我旋转相机拍摄照片时,会发生此错误。

camera uiimagepickercontroller swift3 ios10

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

camera ×2

uiimagepickercontroller ×2

ios ×1

ios10 ×1

ios7 ×1

iphone ×1

swift3 ×1