2

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.

  • That is a feature to force your app to restart if it no longer has access to some private data – David Rönnqvist May 30 '13 at 06:49
  • Means i cann't handle this ? my app will always crash if this is the situation ? –  May 30 '13 at 07:00
  • AFAIK it will be killed when that setting changes. The same for access to the users photos. – David Rönnqvist May 30 '13 at 07:39
  • there should be some way to handle this, I think. –  May 30 '13 at 09:06
  • 1
    It only happens in simulator because debugger is connected to the app in simulator while it's trying to restart the app. Just stop the execution while it crash, it will run good. Check the behaviour in the phone. It won't crash. Instead it will restart the app. – Dinesh Raja Sep 02 '13 at 12:56

0 Answers0