How to ask for permission to access iphone contact

2020-02-14 03:15发布

问题:

I am asking permission to access my contacts using the code below.

    ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL);

    if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {
        ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) {
}
else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized) 
         {

         }
         else 
         {

         }

So far everything is working but however if I delete the app and debug again the app wont ask me the permission again. Prior to if I accepted or declined I can see it in privacy contacts and the name of my app whether its ON or OFF.

I want the app to ask me the permission pop up. what should i do restart the device and reinstall the app. Anyway to clear some sort of cache?

回答1:

You can reset your privacy settings.

Settings > General > Reset > Reset Location & Privacy.