title: ABPeoplePickerNavigationController. Need to show contacts in the same view controller
body: <p>I have a View Controller embedded in a Navigation Controller. It has a button and a table view. I need the contacts from the phone to load in the table view of this View Controller, but what is happening is that a new Navigation controller gets opened which displays the contacts. here's the code of the .m file:</p>
  
  <pre><code>- (IBAction)showContacts:(id)sender
  {
      ABPeoplePickerNavigationController *picker =
      [[ABPeoplePickerNavigationController alloc] init];
      picker.peoplePickerDelegate = self; 
  
     // picker.modalPresentationStyle = UIModalPresentationCurrentContext;
      //picker.modalInPopover = YES;
    //  [self.navigationController presentModalViewController:picker animated:YES];
      [self presentModalViewController:picker animated:YES];
  }
  
  - (void)peoplePickerNavigationControllerDidCancel:
  (ABPeoplePickerNavigationController *)peoplePicker
  {
      [self dismissModalViewControllerAnimated:YES];
  }
  
  
  - (BOOL)peoplePickerNavigationController:
  (ABPeoplePickerNavigationController *)peoplePicker
        shouldContinueAfterSelectingPerson:(ABRecordRef)person {
  
      // [self displayPerson:person];
      [self dismissModalViewControllerAnimated:YES];
  
      return NO;
  }
  
  - (BOOL)peoplePickerNavigationController:
  (ABPeoplePickerNavigationController *)peoplePicker
        shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property
                                identifier:(ABMultiValueIdentifier)identifier
  {
      return NO;
  }
  </code></pre>
  
  <p>This is pretty standard code, I guess. How can I get the contacts to be displayed in the table view of the view controller that has the button, and not in a different controller?</p>
  
  <p>Ok now I've done this:</p>
  
  <pre><code> - (IBAction)syncContacts:(id)sender
      {
          ABAddressBookRef addressBook = ABAddressBookCreate();
          CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
          for (int i = 0; i &lt; ABAddressBookGetPersonCount(addressBook); i++) {
              ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, i);
              NSString *contact = (NSString *)CFBridgingRelease(ABRecordCopyCompositeName(ref));
              NSLog( @"%@", contact);
              phoneContacts[i] = contact;
          }
           NSLog(@"%@",phoneContacts);
      }
  </code></pre>
  
  <p>I've changed the name of the method to syncContacts(for my convenience). The individual contacts are getting fetched and shown in the log when NSLog(@"%@",contact) is getting executed. But when I'm copying contact into phoneContacts array(mutable), it is not copying. I've tried addObject, insertObject:atIndex:, replaceObjectAtIndex:withObject: etc, but still the phoneContacts array remains null. It has been initialized in didViewLoad(). Since nothing is getting stored in phoneContacts array, hence the table view is also not getting populated, as it uses the phoneContacts array.</p>