我在Xcode7.2上边运行,下边的代码
只是黑屏,但不会崩溃。
在Xcode8上运行,
崩溃了,
难道iOS10之后,只能在真机上边运行了吗。
小白求解~~~~
PHPz2017-04-18 09:45:32
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
阿神2017-04-18 09:45:32
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.