From 7cf082bcc4e6d1554a87835b5f15d76f124eab0b Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Thu, 29 Jan 2026 00:01:26 +0200 Subject: [PATCH] Fix Camera support in certain iPhone models, fixes #736 --- iOS/GBViewController.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m index 24aac9ad..3d4b5fc6 100644 --- a/iOS/GBViewController.m +++ b/iOS/GBViewController.m @@ -1998,7 +1998,12 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response _cameraSession = [AVCaptureSession new]; - _cameraSession.sessionPreset = AVCaptureSessionPreset352x288; + if ([device supportsAVCaptureSessionPreset:AVCaptureSessionPreset352x288]) { + _cameraSession.sessionPreset = AVCaptureSessionPreset352x288; + } + else if ([device supportsAVCaptureSessionPreset:AVCaptureSessionPresetMedium]) { + _cameraSession.sessionPreset = AVCaptureSessionPresetMedium; + } [_cameraSession addInput: input]; [_cameraSession addOutput: _cameraOutput]; @@ -2010,6 +2015,7 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response @catch (NSException *exception) { /* I have not tested camera support on many devices, so we catch exceptions just in case. */ GB_camera_updated(&_gb); + _cameraSession = nil; } }); }