Reputation: 2057
How to retrieve street, city, state and country of a contact from addressbook in iphone
Upvotes: 0
Views: 220
Reputation: 1433
ABAddressBookRef addressBook = ABAddressBookCreate();
NSArray *array= (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
ABRecordRef person=(ABRecordRef)[array objectAtIndex:i];
firstName=(NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
lastName=(NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
streeName = (NSString *)ABRecordCopyValue(person, kABPersonAddressStreetKey);
ciy = (NSString *)ABRecordCopyValue(person, kABPersonAddressCityKey);
Dont forget to add AddressBook and AddressBookUI framework.
Upvotes: 1
Reputation: 2707
You can use ABAddressBook framework for this. Have a look @ http://developer.apple.com/library/mac/#documentation/UserExperience/Reference/AddressBook/Classes/ABAddressBook_Class/Reference/Reference.html
AddressBookProgrammingGuideforiPhone
Upvotes: 1