本文介绍了如何从ABPeoplePickerNavigationController获取街道地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要联系人的街道地址。我知道如何获取单值属性,但街道地址是多值属性。 Apple的文档显示了如何设置它,但没有检索它。有什么帮助吗?

I need a contact's street address. I know how to get the single value properties, but the street address is a multivalue property. Apple's documentation shows how to set it, but not retrieve it. Any help?

PS:这不起作用:

ABRecordCopyValue(person, kABPersonAddressStreetKey);


推荐答案

我只是想通了:

ABMultiValueRef st = ABRecordCopyValue(person, kABPersonAddressProperty);
if (ABMultiValueGetCount(st) > 0) {
    CFDictionaryRef dict = ABMultiValueCopyValueAtIndex(st, 0);
    self.street.text = CFDictionaryGetValue(dict, kABPersonAddressStreetKey);
}

这篇关于如何从ABPeoplePickerNavigationController获取街道地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-12 20:45