Can't add a nil AVCaptureInput
Asked Answered
V

4

6

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.

Volvulus answered 8/5, 2013 at 22:0 Comment(1)
What version of the iOS SDK was this? Has it been fixed in the later releases?Buy
A
14

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

Atman answered 6/2, 2014 at 12:1 Comment(2)
Great. worked for me. 1 upvote for you. I didn't understand why deviceInput can't be added. Please enlight me. ThanksBulletin
first is first, thanks for the upvote :) usually the availability of the camera depends on the user permission to use it, as you know the user can decline or revoke the permission. this is from the device perspective, but as for the simulators, there is no camera to start with. wish it was helpfulAtman
R
7

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

Relativistic answered 23/1, 2015 at 19:10 Comment(0)
H
0

I just tested the iOS WebRTC SDK on my iPad 2 with iOS 6.1.4 and I do not experience any crashes. If you can, I would suggest updating the SDK and your iPad version.

If you continue to experience crashing, posting logs here will be super useful!

Honewort answered 19/7, 2013 at 11:32 Comment(0)
U
0

Don't run on simulator. Just run on iPhone.

Ultramodern answered 25/8, 2020 at 3:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.