Reputation: 14148
I have too much code to post here so I was wondering if I could get some code sample regarding iPhone address-book frame work to get an idea.
currently when I pick up phone number from address book, I show actual phone number in the text control as follows:
Question: Is it possible for me to just show actual full name in the control but behind the scenes be able to capture phone number from the control.
I would very much appreciate the sample code that deals with iPhone address-book framework. Thanks..
Upvotes: 3
Views: 989
Reputation: 650
I think you might be already using code something like below: Once you get the ID of the person from address book,
ABAddressBookRef addressBook = ABAddressBookCreate();
ABRecordRef recordRef = ABAddressBookGetPersonWithRecordID(addressBook,ID);
ABMutableMultiValueRef emailMultiValue = ABRecordCopyValue(recordRef, kABPersonPhoneProperty);
where ID is the record id from address book.
You can get the name by:
NSString *firstName = (NSString *)ABRecordCopyValue(recordRef, kABPersonFirstNameProperty);
NSString *lastName = (NSString *)ABRecordCopyValue(recordRef, kABPersonLastNameProperty);
So now you have the name and number. And you can just show actual full name in the control but behind the scenes you can capture phone number from the control.
Hope this helps.
Upvotes: 1