Return Selected Phone Address from iPhone Address Book
- by Ali
Hey,
I found a tutorial online that extends that Apple QuickStart Application which is the basic Address Book Application and another that returns the first phone number regardless of what phone number was clicked. I want to display only the selected phone number in the label. The label is called phoneNumber:
- (BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier{
ABMutableMultiValueRef phoneMulti = ABRecordCopyValue(person, kABPersonPhoneProperty);
NSMutableArray *phones = [[NSMutableArray alloc] init];
int i;
for (i = 0; i < ABMultiValueGetCount(phoneMulti); i++) {
NSString *aPhone = [(NSString*)ABMultiValueCopyValueAtIndex(phoneMulti, i)autorelease];
[phones addObject:aPhone];
}
NSString *mobileNo = [phones objectAtIndex:0];
self.phoneNumber.text = phones;
[self dismissModalViewControllerAnimated:YES];
return NO;
}
How do I ensure that the label is the one selected by the user and not just the first array entry(or any other array entry i code in)
Thanks