首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

地址簿(Address Book)运用例子

2012-09-19 
地址簿(Address Book)使用例子ABAddressBookRef addressBook ABAddressBookCreate()CFArrayRef peopleW

地址簿(Address Book)使用例子

ABAddressBookRef addressBook = ABAddressBookCreate();CFArrayRef peopleWithName = ABAddressBookCopyPeopleWithName(addressBook, (CFStringRef)@"name");if((int)CFArrayGetCount(peopleWithName)){CFIndex theIndex= 0;ABRecordRef personRecord = CFArrayGetValueAtIndex(peopleWithName, theIndex);       //kABPersonPhoneProperty to get phone number       //ABMultiValueRef eMails= ABRecordCopyValue(personRecord,kABPersonEmailProperty);ABMultiValueRef phoneNumbers= ABRecordCopyValue(personRecord, kABPersonPhoneProperty);       if(ABMultiValueGetCount(phoneNumbers)){       CFStringRef phoneNumber = ABMultiValueCopyValueAtIndex(phoneNumbers, 0);       if(phoneNumber!=nil){//TODO:to save the phone number//release the Phone NumberCFRelease(phoneNumber);}}CFRelease(phoneNumbers);}CFRelease(peopleWithName);CFRelease(addressBook);
?

热点排行