我试图找出默认情况下iPhone地址簿中完整的“人员记录”具有哪些属性。
它必须隐藏在API中的某个位置
https://developer.apple.com/documentation/addressbook#//apple_ref/doc/uid/TP40007210
但到目前为止我没有找到一份清单。
有任何人有一个属性列表:名称,名字,电子邮件,电话和可能的“隐藏”字段,如条目创建
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
ABAddressBookRef addressBook = ABAddressBookCreate();
NSArray *array= (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
for (id persion in array)
{
ABRecordRef record = (ABRecordRef)persion;
NSString* firstName=(NSString *)ABRecordCopyValue(record, kABPersonFirstNameProperty);
NSString* lastName=(NSString *)ABRecordCopyValue(record, kABPersonLastNameProperty);
//do something
[firstName release];
[lastName release];
ABMultiValueRef mulPhone = (ABMultiValueRef) ABRecordCopyValue(record, kABPersonPhoneProperty) ;
int count = ABMultiValueGetCount(mulPhone);
for(CFIndex i=0 ; i < count ; i++)
{
NSString* phoneLabel = (NSString*) ABMultiValueCopyLabelAtIndex(mulPhone, i) ;
NSString* cellPhone =(NSString*) ABMultiValueCopyValueAtIndex(mulPhone, i) ;
//do something
[phoneLabel release] ;
[cellPhone release];
}
CFRelease(mulPhone) ;
ABMultiValueRef mulAddress =(ABMultiValueRef) ABRecordCopyValue(record, kABPersonAddressProperty) ;
count = ABMultiValueGetCount(mulAddress);
for(CFIndex i=0 ; i< count ; i++)
{
NSString* addressLabel = (NSString*) ABMultiValueCopyLabelAtIndex(mulAddress, i) ;
CFDictionaryRef dict = (CFDictionaryRef)ABMultiValueCopyValueAtIndex(mulAddress, i);
NSString* homeStreet = (NSString*)CFDictionaryGetValue(dict, kABPersonAddressStreetKey);
NSString* homeCity = (NSString*)CFDictionaryGetValue(dict, kABPersonAddressCityKey);
NSString* homeCountry = (NSString*)CFDictionaryGetValue(dict, kABPersonAddressCountryKey);
//do something
CFRelease(dict) ;
[addressLabel release];
}
CFRelease(mulAddress) ;
NSString* company = (NSString*)ABRecordCopyValue(record, kABPersonOrganizationProperty);
if (company) {
//do something
}
[company release];
ABMultiValueRef mulEmail = (ABMultiValueRef)ABRecordCopyValue(record, kABPersonEmailProperty) ;
count = ABMultiValueGetCount(mulEmail);
for(CFIndex i=0 ; i< count; i++)
{
NSString* emailLabel = (NSString*)ABMultiValueCopyLabelAtIndex(mulEmail, i) ;
NSString* email = (NSString*) ABMultiValueCopyValueAtIndex(mulEmail, i) ;
//do something
[emailLabel release];
[email release];
}
CFRelease(mulEmail) ;
}
[array release];
CFRelease(addressBook);
[pool release];
kABFirstNameProperty:名字。
kABLastNameProperty:姓氏。
kABFirstNamePhoneticProperty:名字的语音表示。
kABLastNamePhoneticProperty:姓氏的语音表示。
kABNicknameProperty:昵称。
kABMaidenNameProperty:少女名字。
kABBirthdayProperty:出生日期。
kABBirthdayComponentsProperty:出生日期作为日期组件。
kABOrganizationProperty:公司名称。
kABJobTitleProperty:职位名称。
kABHomePageProperty:主页。
CubralSprapperty:网页。
kABCalendarURIsProperty:日历URI。
kABEmailProperty:电子邮件地址。
kABAddressProperty:街道地址。
kABOtherDatesProperty:与某人相关的日期。
kABOtherDateComponentsProperty:与人关联的日期,作为日期组件。
kABRelatedNamesProperty:与某人相关的人员姓名。
kABDepartmentProperty:部门名称。
kABPersonFlags:指定通讯簿应用程序中记录的名称排序和配置的属性。见Person Flags。
kABPhoneProperty:通用电话号码。
kABInstantMessageProperty:即时消息ID。
kABNoteProperty:Notes。
kABSocialProfileProperty:社交网络个人资料。
kABMiddleNameProperty:中间名。
kABMiddleNamePhoneticProperty:中间名的语音表示。
kABTitleProperty:标题,例如“Mr.”,“Mrs.”,“General”,“Cardinal”或“Lord”。
kABSuffixProperty:后缀,例如“Sr.”,“Jr。”,“III。”或“Esq”。
因为一个人是一个记录,它也有:https://developer.apple.com/documentation/addressbook/address_book_objective_c_constants/default_record_properties
kABUIDProperty:此记录的唯一ID。无论记录变化多少,都保证永远不会改变。如果需要存储对记录的引用,请使用此值。
kABCreationDateProperty:首次保存记录的日期。
kABModificationDateProperty:上次保存记录的日期。
注意,properties()
应该返回一个Person的所有属性的列表。