为什么我会在这里崩溃?
名字、姓氏和电子邮件地址非常有用!当我到达地址时,我崩溃了。
NSString *firstName = (NSString *)ABRecordCopyValue(thisPerson, kABPersonFirstNameProperty);
NSString *lastName = (NSString *)ABRecordCopyValue(thisPerson, kABPersonLastNameProperty);
NSString *emailAddress = (NSString *)ABRecordCopyValue(thisPerson, kABPersonEmailProperty);
NSString *address = (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressStreetKey);
NSString *city = (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressCityKey);
NSString *state = (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressStreetKey);
NSString *zip = (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressZIPKey);
The firstname, lastname and email address work great! as soon as I get to address, im crashing.
NSString *firstName = (NSString *)ABRecordCopyValue(thisPerson, kABPersonFirstNameProperty);
NSString *lastName = (NSString *)ABRecordCopyValue(thisPerson, kABPersonLastNameProperty);
NSString *emailAddress = (NSString *)ABRecordCopyValue(thisPerson, kABPersonEmailProperty);
NSString *address = (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressStreetKey);
NSString *city = (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressCityKey);
NSString *state = (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressStreetKey);
NSString *zip = (NSString *)ABRecordCopyValue(thisPerson, kABPersonAddressZIPKey);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
地址是 MultiValue 属性(
(kABMultiDictionaryPropertyType 类型的多值属性
),您无法直接使用ABRecordRef
对象访问它。您首先需要获取该多值属性,然后使用您可以访问街道、城市和其他地址属性。
Address is MultiValue Property (
(a multivalue property of type kABMultiDictionaryPropertyType
) you can not access it like this directly usingABRecordRef
object.You first need to get that multivalue property and then using this you can access the street,city and other address properties.