简体   繁体   中英

C4Camera example crashes on XCode 4.6 and XCode 5

The main example https://gist.github.com/C4Tutorials/5399635 crashes in the simulator with the following error: NSInvalidArgumentException', reason: '*** Can't add a nil AVCaptureInput'

It does work when launched on hardware. Is this a known issue or is there a workaround?

i think you can prevent the crash by checking the availability of the AVCaptureInput object before you add it to the AVCaptureSession.

to simplify it check the below code this will prevent the crash on the simulator but it won't help you test it.

try to find where ever you add a AVCaptureInput to a AVCaptureSession and put the following piece of code .

if ([session canAddInput: backCameraDeviceInput])
{
    [session addInput: backCameraDeviceInput];
}

i wish this was helpful :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM