Question

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?

Was it helpful?

Solution

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 :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top