What I'm trying to do is show the people picker to the user, make him select all the contacts he wants, and finally get all those contacts' email addresses in an array. The best would be showing only contacts with email to the user.
Until now the only thing I've been able to do is presenting the people picker with this code:
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentModalViewController:picker animated:YES];
Then I was trying to use this code to get the selected contacts' email:
- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
ABMultiValueRef multi = ABRecordCopyValue(person, kABPersonEmailProperty);
[email addObject:(__bridge NSString*)ABMultiValueCopyValueAtIndex(multi, 0)];
[self dismissModalViewControllerAnimated:YES];
return YES;
}
But the picker is going away as soon as I select a contact, so I don't know how to continue. Moreover, right when I select a contact I get this in the console:
"Unbalanced calls to begin/end appearance transitions for
<ABMembersViewController: 0xa1618c0>."
Any help would be appreciated.