iOS打开摄像头时出现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.
网上一堆办法都没有解决,求大神
代码
case 0://从照相机拍照
//--判断相机是否可用
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
//有相机
UIImagePickerController *ipc = [[UIImagePickerController alloc]init];
ipc.modalPresentationStyle = UIModalPresentationCurrentContext;
//self.imagePicker = ipc;
[ipc setSourceType:UIImagePickerControllerSourceTypeCamera];
ipc.allowsEditing = YES;
ipc.delegate = self;
//self.imagePicker = ipc;
//跳转到UIImagePickerController
[self presentViewController:ipc animated:YES completion:nil];
}
else {
NSLog(@"这设备没相机 ");
}
break;
楼上那个方法我试过,还试过一些其他的方法,比如延时调用啦,把 imagePicker 存成全局变量啦,总之在爆栈上查到的方法我都试了一个遍了…… 结果都没有解决问题。
不过可以负责任地告诉题主~~ 这只是个 warning,不影响正常使用,某大公司的 app 也会报这个 warning。你就直接忽略掉它吧~