title: code for fetching contacts is not working on iphone 5 but its working fine in iphone 4
body: <p>I have developed an app which is fetching contacts from iphone its working fine in iphone 4 but it is failed to do the same in iphone 5 .
  view did load--------</p>
  
  <pre><code>ABAddressBookRef addressBook = ABAddressBookCreate();
  
      CFErrorRef myError = NULL;
  
      ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, &amp;myError);
   switch (ABAddressBookGetAuthorizationStatus()) {
          case kABAuthorizationStatusNotDetermined: {
              NSLog(@"kABAuthorizationStatusNotDetermined");
              ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) {
                  // First time access.
                  AddressBookUpdated(addressBookRef, nil, (__bridge void *)(self));
                  CFRelease(addressBookRef); void insert();
              }); }
              break;
          case kABAuthorizationStatusRestricted:{
              NSLog(@"kABAuthorizationStatusRestricted");
          }
              break;
          case kABAuthorizationStatusDenied:
              NSLog(@"kABAuthorizationStatusDenied");
              break;
          case kABAuthorizationStatusAuthorized:{
              NSLog(@"kABAuthorizationStatusAuthorized");
              AddressBookUpdated(addressBookRef, nil, (__bridge void *)(self));
              CFRelease(addressBookRef);
              break;
          }}
  </code></pre>
  
  <p>function for fetching contact in this function i am fetching contacts &amp; taking them in an array </p>
  
  <pre><code>void AddressBookUpdated(ABAddressBookRef addressBook, CFDictionaryRef info, void *context) {
  
      @try{
      NSString *userDefKey;
      NSString *docsDir;
      NSArray *dirPaths;
      const char *dbpath;
      NSString *databasePath;
      sqlite3 *contactDB;
      sqlite3  *db;
      NSString *dbPath1;
      NSString *dbPath;
  
     NSMutableArray *data,*number,*email;
     data=[[NSMutableArray alloc]init];
     number=[[NSMutableArray alloc]init];
      email=[[NSMutableArray alloc]init];
  
      ABAddressBookRevert(addressBook);
      CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
      CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);
  
      ABAddressBookRef addressBook1 = ABAddressBookCreate();
      NSArray *people1 = (__bridge NSArray*)ABAddressBookCopyArrayOfAllPeople(addressBook);
  
  
      for ( int i = 0; i &lt; nPeople; i++ )
      {
          ABRecordRef person = CFArrayGetValueAtIndex( allPeople, i );
          NSString *firstName = (__bridge NSString *)(ABRecordCopyValue(person, kABPersonFirstNameProperty));
          NSString *lastName = (__bridge NSString *)(ABRecordCopyValue(person, kABPersonLastNameProperty));
          NSString *emailid;
          ABMultiValueRef emailProperty = ABRecordCopyValue(person, kABPersonEmailProperty);
         // ABMultiValueRef multi = ABRecordCopyValue((__bridge ABRecordRef)(person), kABPersonPhoneProperty);
          //NSString *eid=(__bridge NSString *)(ABRecordCopyValue(person, kABPersonEmailProperty));
          NSArray *emailArray = (__bridge NSArray *)ABMultiValueCopyArrayOfAllValues(emailProperty);
         // NSInteger *i=(__bridge NSInteger*)ABRecordCopyValue(person, kABPersonPhoneMobileLabel);
  
          if(emailArray.count==0)
              [email addObject:@" "];
          else{
          emailid=emailArray[0];
          if(emailid.length!=0)
          [email addObject:emailid];
          }
              //NSLog(@"email array %@",eid);
  
          if(lastName.length&lt;1)
          {
              [data addObject:firstName];
  
          }
          else
          {
              NSString *combined = [NSString stringWithFormat: @"%@ %@",
                                    firstName, lastName];
              [data addObject:combined];
          }
  
  
          }
      //NSLog(@"phone count is %d",data.count);
     //number = [NSMutableArray arrayWithCapacity:data.count];
      //NSLog(@"phone count is %d",number.count);
      for(id person in people1){
          //fetch multiple phone nos.
          ABMultiValueRef multi = ABRecordCopyValue((__bridge ABRecordRef)(person), kABPersonPhoneProperty);
          for (CFIndex j=0; j &lt; ABMultiValueGetCount(multi); j++) {
              NSString* phone = (__bridge NSString*)ABMultiValueCopyValueAtIndex(multi, j);
              //NSLog(@"phone no is %@",phone);
              [number addObject:phone];
  
          }
      }
  
  
      NSLog(@"data is %@",data);
      NSLog(@"phone number %@",number);
      NSLog(@"email id is %@",email);
  }
  </code></pre>