Open nzohrab opened 4 days ago
Just confirming the workaround mentioned above does work for our app!
Hello.
Yes, on iOS if the permission is denied once you have to handle the result and prompt your user to manually grant the permission in settings. See here: https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/appmodel/permissions?view=net-maui-8.0&tabs=macios#platform-differences
Hello there,
I've come across an issue which crashes the app under iOS. I've tested on the latest version 1.5.8, and as far back as 1.3.1 and the issue is there too.
To recreate this, in BarcodeScanning.Test, click the 'Open ScanPage' button. Then when asked for camera permissions, click 'Don't Allow'. Then click the '<' back button. Finally, click 'Open ScanPage' again, and the app crashes, giving this error:
System.Exception: 'Could not initialize an instance of the type 'AVFoundation.AVCaptureDeviceInput': the native 'initWithDevice:error:' method returned nil. It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.'
On this line of code:
_captureInput = new AVCaptureDeviceInput(_captureDevice, out _);
In MaciOS/CameraManager.cs
In short it seems like the crash happens when permissions have been denied and the user lands on a page with the CameraView on it.
For reference, I'm running iOS version 17.5.1 on an IPhone 12. We've had users telling us they're having this issue with our app too.
I'm not sure about a workaround at the moment, but I'm going to try only injecting the CameraView into the page if camera permissions are granted and see how that goes.