iOS Question How to detect camera permission authorization state?

Angel Garcia

Member
Licensed User
Hi all,
I'm using the camera library to let the user take a photo from its iPhone, as you know when the user grants the permission first time everything works fine, but if he denies it, it never request permission never again, and when the 'cam.takepicture' event is fired it just show black screen on the camera. After a lot of research i have found a method in OBJC that returns the permission status of the camera, and with this at least i can guide the user to do the proper settings on the app to allow the permissions, but i'm a total noob on OBJC, maybe an expert on the forum could help me out for this purpose. 🙏
Below the links that help:
https://stackoverflow.com/questions/20464631/detect-permission-of-camera-in-ios
https://stackoverflow.com/questions...ey-have-already-denied-it-o?noredirect=1&lq=1

I tried to do it on a b4i page, but it didnt work, it didnt even compiled at all, maybe some expert could help me for this purpose:
So far mi code is this:
obj:
Sub DoIHaveCamAccess() As Boolean
   
    'AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType];
    Dim status As Boolean=False
    Dim no As NativeObject
    no.Initialize("AVCaptureDevice")
    status=no.RunMethod("authorizationStatusForMediaType",Array As Object("AVMediaTypeVideo")).AsNumber ' The App crash here'
   
    If status=True Then
        Return True
    Else
        Return False
    End If
   
End Sub

I believe i'm close but i think something is missing. I also tried copy and paste the OBJC codes and put them on a specific region and call them from the subs, but it didnt work,
Any help would be appreciated, or maybe there is another workaround?.
Regards!!
 

Angel Garcia

Member
Licensed User
Yes i have seen that option, but, I'm using the camera library from the iMedia Library, that i think its better, and its already implemented in the App.
Is there a straight way to check the permission with OBJC?
Check the value of LLCamera.AuthorizationDenied.
 
Upvote 0
Top