My app offers user the option to import Contacts. When you try to access Contacts, Apple shows its privacy dialog. Then if the user selects Allow Access and, in turn, Share All Contacts, full access is granted.
After the initial selection, if anything less than full access is granted, I have code that sends the user to Settings where they should have the option to choose again between None, Limited Access and Full Access as below for Facebook. If they choose not to go to settings, I show them Apple's contact picker.
However, sometimes for my app, instead of showing what Facebook shows, it shows "Private Access" with no ability to choose another option. Could this be because I briefly let them use the Contact Picker? I don't think that should be the case. Is this an Apple bug?
Private Access is not one of the normal 3 options as shown for Facebook, None, Limited Access and Full Access. I'm not sure what it is.
Even when I delete the app from the phone, and reinstall it using Xcode, I am currently getting the same problem.
What could be causing this and, even if it is a bug on Apple's part, what workaround could I use to prevent it?
(IBAction)seeSystemContacts:(id)sender {
if ([self fullAccessToSystemContacts]) {
[self launchImportContactsVC];//This takes user to a VC where they can see contacts
}
else { //Following launches a dialog with two options
[[Utilities shared] getUserInputOnVC:self
title:@"See Contacts"
body:@"Allow app to access your contacts in Settings" buttons:@[@"Not now", @"Settings"] completion:^(NSInteger choice){
if (choice==1) {
//That would be Go to Settings
[self gotoSettings];
}
else {
//Not now
//Third Fallback if they click Not Now, show them contactPicker option
[[ContactPicker shared] openContactPickerOnViewController:self completion:^(NSArray *contacts){
[self.fetchedResultsController performFetch:nil];
[self.tableView reloadData];
}];
}
}];
}
}
-(BOOL)fullAccessToSystemContacts {
CNContactStore *store = [[CNContactStore alloc] init];
CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];
if (status == CNAuthorizationStatusAuthorized) {
return YES;
}
return NO;
}
NSContactsUsageDescription
. You get the Facebook options when you request access toCNContactStore
(assuming you set theNSContactsUsageDescription
).