0

I am trying to get camera functionality to work in Xamarin.iOS on an iPad with an Enterprise account.

When I use an Enterprise account, the app crashes as soon as I ask for permission:

var status = await CrossPermissions.Current.RequestPermissionAsync<CameraPermission>();

even though a message shows if I want to let the app use the camera. When I say I want to use the camera and then open the app again, I CAN use the camera without issues. I have set the Camera Usage Description in the Info.pList (When I run the same line of code with a developer subscription on the same iPad, it does not crash the first time, and it does not ask for permission)

Is there anything I am missing? Is there another solution I can use?

Xamarin.Forms           v4.8.0.1687
Xamarin.Essentials      1.6.0-pre3
Plugin.Permissions      6.0.1
iPad                    iOS13.2.3

I use VS2019 in Windows

  • 1
    have you tried to catch the exception causing the crash? Is anything shown in the logs? – Jason Dec 04 '20 at 16:19
  • I have tried to catch the exception and didn't find anything in the logs. – Vincent van Rooijen Dec 04 '20 at 18:12
  • @VincentvanRooijen Hi, do you have a try with using [xamarin essentials](https://learn.microsoft.com/en-us/xamarin/essentials/permissions?context=xamarin%2Fxamarin-forms&tabs=android#requesting-permissions) to ask the permission? – Junior Jiang Dec 07 '20 at 02:26
  • @JuniorJiang-MSFT, yes, I have tried that too. That also crashes. – Vincent van Rooijen Dec 07 '20 at 03:25
  • @VincentvanRooijen Not using the preview version of xamarin essentials. And if you have other devices, can have a try. – Junior Jiang Dec 07 '20 at 03:26
  • @VincentvanRooijen And here is a native method to ask permission for camera, you also could have a try.https://stackoverflow.com/questions/31177640/read-camera-permission-for-ios-in-xamarin – Junior Jiang Dec 07 '20 at 03:31
  • @JuniorJiang-MSFT, so I use that in Xamarin.iOS and not in the general Xamarin code for all devices? – Vincent van Rooijen Dec 07 '20 at 15:35
  • @VincentvanRooijen Generally, it should work for all devices. But here it not works, so you could have a try with native method to check whether it works. If it works, it should be an issue for the `xamarin essentials` and `Plugin.Permissions`, then can submit it in github. – Junior Jiang Dec 08 '20 at 01:46

0 Answers0