0

I have an app which is invisible and runs in the background on iPhone. App wants to access contacts from the iPhone but not getting that due to kABAuthorizationStatusDenied. Here is the code for accessing the contacts.

ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL);

if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) {
    ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) {
      if (granted) {
          // access has been granted.
      } else {
          // User denied access
      }
    });
  }
  else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized) {
    // The user has previously given access
  }
  else {
    // The user has previously denied access
  }

It always runs the last else part which is //The user has previously denied access. It means that user has explicitly denied access to contacts. what is the solution? I have tried to Reset Location & Privacy in Settings --> General --> Reset but still getting in the else part which is user has denied access.

Specifications:
iPhone: 5s
iOS : 7.1

1 Answers1

0

Steps:

iOS 8+

  1. Settings -> Select Your App Name -> Privacy -> Enable permission for Contacts app.

iOS 7

  1. Settings -> Privacy -> Contacts -> Select Your App name -> Enable permission
PREMKUMAR
  • 8,283
  • 8
  • 28
  • 51
  • premkumar thanks for replying but as i said my app is invisible. we cannot see it in the iPhone as its not appear anywhere.It runs in the background mode So in Settings -> Privacy -> Contacts -> my app doesn't show up. That's Why i cannot change the privacy settings of my app. Is there any other way around??? – Iphone Developer Sep 03 '14 at 10:05