为什么我会在这里崩溃?

发布于 2024-10-31 14:24:46 字数 826 浏览 6 评论 0原文

名字、姓氏和电子邮件地址非常有用!当我到达地址时,我崩溃了。

            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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

栩栩如生 2024-11-07 14:24:46

地址是 MultiValue 属性((kABMultiDictionaryPropertyType 类型的多值属性),您无法直接使用 ABRecordRef 对象访问它。

您首先需要获取该多值属性,然后使用您可以访问街道、城市和其他地址属性。

Address is MultiValue Property ((a multivalue property of type kABMultiDictionaryPropertyType) you can not access it like this directly using ABRecordRef object.

You first need to get that multivalue property and then using this you can access the street,city and other address properties.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文