search

Home  >  Q&A  >  body text

iOS10 模拟器上边运行【AVCaptureSession startRunning】崩溃。

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

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


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

巴扎黑巴扎黑2771 days ago774

reply all(3)I'll reply

  • PHPz

    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

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:45:32

    The operation involving calling the camera must require a real machine

    reply
    0
  • 阿神

    阿神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.

    reply
    0
  • Cancelreply