Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't add a nil AVCaptureInput

I have a beta tester getting this error when trying to start a video session on our iPad app using the OpenTok iOS WebRTC SDK. The app crashes every time. User is on an iPad 2 with iOS 6.1.3. Does anyone have a clue what could be causing such an error? My best guess is something involving camera access, but I'm at a loss for what it could be.

like image 210
nickd717 Avatar asked May 08 '13 22:05

nickd717


2 Answers

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:

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

i wish this was helpful :)

like image 200
Ahmad Al-Attal Avatar answered Nov 14 '22 21:11

Ahmad Al-Attal


This occurs when the user has not acquired permission to use the camera or the user has turned it off (my cause). Best to check and remind user to give permission to use camera. Settings->privacy->camera

like image 27
rednic Avatar answered Nov 14 '22 22:11

rednic