Reputation: 29
I use this code, for kABPersonEmailProperty
it works, but for kABPersonLastNameProperty
not.
Why?
NSMutableArray *allNumbers = [[NSMutableArray alloc] initWithCapacity:CFArrayGetCount(people)];
for (CFIndex i = 0; i < CFArrayGetCount(people); i++) {
ABRecordRef person2 = CFArrayGetValueAtIndex(people, i);
ABMultiValueRef numbers = ABRecordCopyValue(person2, kABPersonLastNameProperty);
for (CFIndex j=0; j < ABMultiValueGetCount(numbers); j++) {
NSString* number = (NSString *)CFBridgingRelease(ABMultiValueCopyValueAtIndex(numbers, j));
[allNumbers addObject:number];
}
CFRelease(numbers);
}
Upvotes: 0
Views: 35
Reputation: 318774
A contact only has one last name. Simply do:
NSString *lastName = (__bridge_transfer NSString *)ABRecordCopyValue(person2, kABPersonLastNameProperty);
Upvotes: 1