I hit this weird problem when implementing ABPeoplePickerNavigationControllerDelegate. So identifier sometime was got its value incorrectly in delegate method
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier;
For example when I chose the first number from a contact, identifier should be 0. But sometime it was 1 (even when that contact only has 1 number)!!
It is easy to verify that,
...
ABMultiValueRef phoneProperty = ABRecordCopyValue(person,property);
int count = ABMultiValueGetCount(phoneProperty);
NSLog(@"How many numbers do I have %d and which number do I choose %d",count,identifier);
And it printed out this sometime
How many numbers do I have 1 and which number do I choose 1
so has anyone hit the same problem as well ?
Update: sometime identifier is even bigger than count. How come!!
How many numbers do I have 2 and which number do I choose 3