I think you can prevent a crash by checking the availability of the AVCaptureInput object before adding it to AVCaptureSession.
to simplify it, check the code below:
if ([session canAddInput: backCameraDeviceInput]) { [session addInput: backCameraDeviceInput]; }
I would like it to be useful :)
source share