title: iOS App gets crash in background as changed Settings->Privacy->Contacts My App ON/OFF
body: <p>In my app i am getting contact information directly buy doing this ...</p>
  
  <pre><code>ABAddressBookRef m_addressbook = ABAddressBookCreate();
  
  CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(m_addressbook);
  
  CFIndex nPeople = ABAddressBookGetPersonCount(m_addressbook);
  
  for (int i=0;i &lt; nPeople;i++)
  {
      ABRecordRef ref = CFArrayGetValueAtIndex(allPeople,i);
      CFStringRef company,firstName,lastName;
  
       firstName = ABRecordCopyValue(ref, kABPersonFirstNameProperty);
       lastName  = ABRecordCopyValue(ref, kABPersonLastNameProperty);
       company = ABRecordCopyValue(ref, kABPersonOrganizationProperty);
  }
  </code></pre>
  
  <p>So, i need to check first Whether this is ON/OFF Settings --> Privacy --> Contacts ON/OFF for my app.</p>
  
  <p>For this I am doing this :</p>
  
  <pre><code>__block BOOL accessGranted = NO;
  
  
  float sysver = [[[UIDevice currentDevice]systemVersion]floatValue];
  
  if(sysver&gt;=6) {
      ABAddressBookRef addressBook = ABAddressBookCreate();
  
      if (ABAddressBookRequestAccessWithCompletion != NULL) {  
          dispatch_semaphore_t sema = dispatch_semaphore_create(0);
          ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
              accessGranted = granted;
              dispatch_semaphore_signal(sema);});
  
       dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
       dispatch_release(sema);
       } else { 
           accessGranted = YES;
       }
  } else {
      accessGranted = YES;
  }
  
  if(accessGranted) 
  {
      // doing my stuff and moving on
  } else {
      // please make Settings --&gt; Privacy --&gt; Contacts  my app.  ON for accessing contacts.
  }
  </code></pre>
  
  <p>My issues is , at very first time after installing app on device , app asked me to "Don't allow"/ "Ok" alert for contact grant access. I clicked on Ok but Settings --> Privacy --> Contacts for my app was OFF so again got alert to make it ON, "Settings" "Ok" so selected Settings , and i made it ON ,, once i made it ON app get SIGKILL nothing to console.</p>
  
  <p>and later whenever i changed Privacy setting to OFF to ON app getting crash at background . i get SIGKILL nothing to console.</p>
  
  <p>Thanks In Advance.</p>