Question

My app was rejected by the apple review team. According to them the reason is

"17.1: Apps cannot transmit data about a user without obtaining the user's prior permission and providing the user with access to information about how and where the data will be used.Specifically, your app accesses the Users contacts with out requesting permission first"

But, I have used **NSContactsUsageDescription** key in my info.plst to specify the reason of using contacts in my app.

What should I have to do additionally for get permission?

Was it helpful?

Solution 2

You have to ask user whether your application can access your Address book. This feature is implemented in iOS 6.0 and above.

You Can try this code Snippet:

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

in - viewWillAppear:

// Asking access of AddressBook
// if in iOS 6
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) 
{ 
    // Request authorization to Address Book
    addressBook_ = ABAddressBookCreateWithOptions(NULL, NULL);

    if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined)
    {
         ABAddressBookRequestAccessWithCompletion(addressBook_, ^(bool granted, CFErrorRef error)
                                                 {
                                                     if (granted == NO)
                                                     {
                                                         // Show an alert for no contact Access
                                                     }
                                                 });
    }
    else if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized)
    {
        // The user has previously given access, good to go
    }
    else
    {
        // The user has previously denied access
        // Send an alert telling user to change privacy setting in settings app
    }
}
else // For iOS <= 5
{
    // just get the contacts directly
    addressBook_ = ABAddressBookCreate();
}

OTHER TIPS

In iOS 6 You Need to use Address-book permission request iphone to access it's Device Contact:-

enter image description here

method of implement code like this example:

ABAddressBookRef addressBook;
if ([self isABAddressBookCreateWithOptionsAvailable]) {
    CFErrorRef error = nil;
    addressBook = ABAddressBookCreateWithOptions(NULL,&error);
    ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
        // callback can occur in background, address book must be accessed on thread it was created on
        dispatch_async(dispatch_get_main_queue(), ^{
            if (error) {

            } else if (!granted) {


            } else {
                // access granted
                 [self GetAddressBook];


            }
        });
    });
} else {
    // iOS 4/5

     [self GetAddressBook];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top