xcodeavcam

AVCaptureDeviceType crashing on iPad Obejective-C


I am having the same code as on Apple Documentation: https://developer.apple.com/library/archive/samplecode/AVCam/Listings/Objective_C_AVCam_AVCamCameraViewController_m.html#//apple_ref/doc/uid/DTS40010112-Objective_C_AVCam_AVCamCameraViewController_m-DontLinkElementID_7

NSArray<AVCaptureDeviceType> *deviceTypes = @[AVCaptureDeviceTypeBuiltInWideAngleCamera, AVCaptureDeviceTypeBuiltInDualCamera];

Code breaks on this line.

Stack trace screenshot is attached. Stack Trace Screeshot


Solution

  • Take reference from the link below.This solved my problem for camera crashing on iPads with lower iOS versions.

    https://github.com/imjerrybao/AVCam

    Also make sure where your app is crashing. If it is Crashing because of core data(NSPersistentContainer) on lower versions of iOS, try using: INSPersistentContainer instead.

    https://github.com/inspace-io/INSPersistentContainer