Hi,
I am fetching Last&Firstname from the Addressbook - but I am not able to get the RecordID. Does anyone knows how to achieve this?
Thanks for your help,
Stefan
Code:
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFIndex nPeople = ABAddressBookGetPersonCount(addressBook);
masterList = [[NSMutableArray alloc] init];
for (int i = 0; i < nPeople; i++) {
ABRecordRef ref = CFArrayGetValueAtIndex(allPeople, i);
CFStringRef firstName = ABRecordCopyValue(ref, kABPersonFirstNameProperty);
CFStringRef lastName = ABRecordCopyValue(ref, kABPersonLastNameProperty);
NSString *contactFirstLast = [NSString stringWithFormat: @"%@, %@, %d", (NSString *)lastName, (NSString *)firstName];
CFRelease(firstName);
CFRelease(lastName);
[masterList addObject:contactFirstLast];
NSLog(@"masterlist: %@", masterList);
// [contactFirstLast release];
}