iOS10 模拟器上边运行【AVCaptureSession startRunning】崩溃。
巴扎黑
巴扎黑 2017-04-18 09:43:32
0
3
775

我在Xcode7.2上边运行,下边的代码

只是黑屏,但不会崩溃。
在Xcode8上运行,


崩溃了,
难道iOS10之后,只能在真机上边运行了吗。
小白求解~~~~

巴扎黑
巴扎黑

reply all(3)
PHPzhong

The simulator does not originally support this. It is recommended to use a real machine for debugging. If you have to run it on the simulator, just use code to block it:

#if !(TARGET_IPHONE_SIMULATOR)
[self.captureSession startRunning];
#endif
巴扎黑

The operation involving calling the camera must require a real machine

阿神

There is no way to call the camera simulator, only the real machine can. Xcode 8 simulator getting the camera will cause a crash, you can use

UIImagePickerController *picker = [[UIImagePickerController alloc]init];
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;

Try it, in picker.sourceType = UIImagePickerControllerSourceTypeCamera; there is a problem here, it can be called using a real device.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template