I have an iPhone App in which i want so access the phonebook contacts and on the selection of single or multiple contacts i want to send sms to the selected contacts. Please can anybody give me a sample code for doing this app. Thanks in advance.
Asked
Active
Viewed 839 times
-2
-
1We're hear to help those who help themselves, and you won't get a good response here without first demonstrating what you have tried to solve your own problem before asking for the work to be done for you. – Mick MacCallum Feb 14 '13 at 15:23
1 Answers
2
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);
for (int i = 0; i < nPeople; i++) {
// Get the next address book record.
ABRecordRef record = CFArrayGetValueAtIndex(allPeople, i);
// Get array of email addresses from address book record.
ABMultiValueRef emailMultiValue = ABRecordCopyValue(record, kABPersonEmailProperty);
NSArray *emailArray = (__bridge_transfer NSArray *)ABMultiValueCopyArrayOfAllValues(emailMultiValue);
[self.contacts addObject:emailArray];
}
Hope this get u started...

lakshmen
- 28,346
- 66
- 178
- 276