我按照 Apple 关于获取联系人电话号码的教程进行操作,效果很好,但它只检测带有“家庭”标签的电话号码。这是我的代码:
- (void)displayPerson:(ABRecordRef)person {
NSString* phone = nil;
ABMultiValueRef phoneNumbers = ABRecordCopyValue(person,
kABPersonPhoneProperty);
if (ABMultiValueGetCount(phoneNumbers) > 0) {
phone = (__bridge_transfer NSString*)
ABMultiValueCopyValueAtIndex(phoneNumbers, 0);
} else {
phone = @"[None]";
}
self.contactNumber.text = phone;
CFRelease(phoneNumbers); }
任何人都知道它为什么这样做?