I am using the following code to ask the permission from addressbook and save it to app's UserDefaults.
if (ABAddressBookRequestAccessWithCompletion != NULL)
{
// we're on iOS 6
ABAddressBookRef addressBookRef = ABAddressBookCreate();
ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) {
accessgranted = granted;
if(accessgranted)
{
[self saveaddressbookpermission:accessgranted];
[NSThread detachNewThreadSelector:@selector(startbgprocess) toTarget:self withObject:nil];
}
});
CFRelease(addressBookRef);
}
else {
// we're on iOS 5 or older
accessgranted = YES;
[self saveaddressbookpermission:accessgranted];
NSLog(@"in iOS 5");
[NSThread detachNewThreadSelector:@selector(startbgprocess) toTarget:self withObject:nil];
}
The issue is when i try to Reset the privacy settings using Setting->General->Reset -> Reset Location & privacy, but if i try to Change the Privacy Settings from Settings->Privacy-> and switch OFF the permissions from there then my app crashes. How can i handle this situation. Please let me know if any other information required as i am not able to find anything regarding this.