我正在尝试找出iPhone地址簿中完整的“人员记录”在默认情况下具有哪些属性。
它一定隐藏在API中的某个地方
https://developer.apple.com/documentation/addressbook#//apple_ref/doc/uid/TP40007210
但到目前为止我还没有找到一份名单。
任何人都有一个属性列表:姓名、预定名、电子邮件、电话和可能的“隐藏”字段,如创建的条目
发布于 2012-10-08 18:05:49
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];发布于 2017-12-16 19:56:44
kABFirstNameProperty:名字。
kABLastNameProperty:姓氏。
名字的kABFirstNamePhoneticProperty:语音表示。
姓氏的kABLastNamePhoneticProperty:语音表示形式。
kABNicknameProperty:昵称。
kABMaidenNameProperty:婚前名字。
kABBirthdayProperty:出生日期。
作为日期组件的kABBirthdayComponentsProperty:出生日期。
kABOrganizationProperty:公司名称。
kABJobTitleProperty:职务。
kABHomePageProperty:主页。
kABURLsProperty:网页。
kABCalendarURIsProperty:日历URI。
kABEmailProperty:电子邮件地址。
kABAddressProperty:街的地址
与人员关联的kABOtherDatesProperty:日期。
与人员关联的kABOtherDateComponentsProperty:日期,作为日期组件。
与个人相关的人员的kABRelatedNamesProperty:名称。
kABDepartmentProperty:部门名称。
kABPersonFlags:属性,指定通讯簿应用程序中记录的名称顺序和配置。参见Person Flags。
kABPhoneProperty:通用电话号码。
kABInstantMessageProperty:即时通信ID。
kABNoteProperty:注释。
kABSocialProfileProperty:社交网络配置文件。
kABMiddleNameProperty:中间名。
中间名的kABMiddleNamePhoneticProperty:语音表示。
kABTitleProperty:头衔,如“先生”、“夫人”、“将军”、“枢机主教”或“领主”。
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的所有属性的列表。
https://stackoverflow.com/questions/12770666
复制相似问题