我正在尝试按名称在地址簿中搜索电话号码,
-(void)textMessage{
ABAddressBookRef addressBook = ABAddressBookCreate();
NSMutableArray *array;
for(int i = 0;i<[savedPeople count];i++){
array = [[[NSMutableArray alloc]initWithArray:savedPeople]objectAtIndex:i];
CFArrayRef people = ABAddressBookCopyPeopleWithName(addressBook, (CFStringRef)array);
NSLog(@"%@",people);
}
}
我得到了这个的日志
2012-05-01 09:22:31.688 UpOut[5829:15803] (
"<CPRecord: 0x84edf90 ABPerson>"
)
2012-05-01 09:22:31.694 UpOut[5829:15803] (
"<CPRecord: 0x84ee1c0 ABPerson>"
)
我不知道中间的字符串是什么意思,它是否正确返回?
编辑
for(NSString *name in savedPeople){
CFArrayRef people = ABAddressBookCopyPeopleWithName(addressBook, (CFStringRef)name);
CFTypeRef phoneProperty = ABRecordCopyValue((ABRecordRef)people, kABPersonPhoneProperty);
NSLog(@"%@",phoneProperty);
}