iOS Question Camera and Contacts permission access request

Rory Mapstone

Member
Licensed User
Hi,

Recently out of the blue the following has stopped working, and it feels like something has become corrupt.

The app will crash as soon as it asks for permission to use the camera or gain access to contacts (the don't allow / allow dialog pops up and the app crashes immediately, sometimes the pop up does not become visible). Asking permission for locations services is allowed.

b4i Code to ask for contacts permission:
B4X:
Sub Class_Globals
    Private no As NativeObject = Me
    Private ABPermission As Int
End Sub

Public Sub Initialize
    ABPermission = no.RunMethod("GetPermission",Null).AsNumber  'app crashes here
End Sub

This is the OBJC which always returns 6 and logs not determined.

B4X:
@import AddressBook;
- (int)GetPermission
{
    int retVal;
  if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusDenied ||
      ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusRestricted)
    {
    //1
    NSLog(@"Denied");
    retVal = 1;
  } else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized)
  {
    //2
    NSLog(@"Authorized");
    retVal = 2;
  } else
  {
        //ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined
        ABAddressBookRequestAccessWithCompletion(ABAddressBookCreateWithOptions(NULL, nil), ^(bool granted, CFErrorRef error) {
            if (!granted){
                //4
                NSLog(@"Just denied");
                //retVal = 4;
                return;
            }
          //5
          NSLog(@"Just authorized");
          //retVal = 5;
        });
    NSLog(@"Not determined");
    retVal = 6;
  }
  return retVal;
}

Any idea what the issue could be?

Regards
 
Top