我想弄清楚电话号码的种类(家庭、手机、传真等),但我不知道如何使用 ABMultiValueRef
来做到这一点。 .我可以通过以下方式获取类型:
CFStringRef cfLabel = ABMultiValueCopyLabelAtIndex(multiValueRef, i);
NSString *label = (__bridge NSString*) cfLabel;
NSLog(@"%@", label); // prints i.e "_$!<Mobile>!$_"
CFRelease(cfLabel);
因此当它打印 _$!<Mobile>!$_
时我可以做一些 IF 逻辑来检查标签是否等于 _$!<Mobile>!$_
但如果 Apple 决定改变 Mobile 标签的值(value), future 会怎样呢?对我来说,如果有一个我可以检查的常量,感觉会好得多。但是我找不到任何可以使用的东西?
最佳答案
这些 CFStringRef
常量在 AddressBook 框架(准确地说是 ABPerson.h)中定义:
kABPersonPhoneMobileLabel
kABPersonPhoneIPhoneLabel
kABPersonPhoneMainLabel
kABPersonPhoneHomeFAXLabel
kABPersonPhoneWorkFAXLabel
kABPersonPhoneOtherFAXLabel
kABPersonPhonePagerLabel
特别是,kABPersonPhoneMobileLabel
有 _$!<Mobile>!$_
值(value)。
请引用ABPerson reference有关这些常量和 AddressBook 框架定义的其他常量的更多信息。
关于Objective-C – ABMultiValueRef 获取类型 (ABAddressBook),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13234128/