tags:

views:

35

answers:

0

Hi ,

I am developing an application for iPhone which needs to get the email address and phone number of a particular contact from address book.I used the following code to get these details

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker 
                shouldContinueAfterSelectingPerson:(ABRecordRef)person
                property:(ABPropertyID)property
                identifier:(ABMultiValueIdentifier)identifier{

    NSString *strFirstName=(NSString*)ABRecordCopyValue(person,kABPersonFirstNameProperty);
    NSString *strLastName=(NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);       
    ABMultiValueRef multi = ABRecordCopyValue(person,property);
    objGenericDetails.strPhone = (NSString*)ABMultiValueCopyValueAtIndex(multi, ABMultiValueGetIndexForIdentifier(multi, identifier));

    ABMultiValueRef multiEmails = ABRecordCopyValue(person, kABPersonEmailProperty);  
    NSString *strEmail = (NSString *)ABMultiValueCopyValueAtIndex(multiEmails, ABMultiValueGetIndexForIdentifier(multiEmails, identifier));
}

The problem occurs when i have 3 phone numbers in list and only one email address.Is there any way to find whether the user selected Phone number or email??