Вопрос

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top