本文介绍了如何从AddressDictionary获取格式化地址NSString?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试从AddressDictionary获取格式化地址,这是我从CLGeocoder获得的。
使用以下代码但没有结果:
Trying to get formatted address from AddressDictionary, that I got from CLGeocoder.Used following code with no result:
subtitle = [NSString stringWithString:[[addressDict objectForKey:@"FormattedAddressLines"]objectAtIndex:0]];
还试过:
subtitle = [[[ABAddressBook sharedAddressBook] formattedAddressFromDictionary:placemark.addressDictionary] string];
但此代码似乎仅适用于Mac OS X.
but this code seems working on Mac OS X only.
编译器询问ABAdressBook,但我导入了两个头文件。
Compiler asks about ABAdressBook, but I have both header files imported.
#import <AddressBook/ABAddressBook.h>
#import <AddressBook/AddressBook.h>
推荐答案
地址字典的文档
属性说:
所以添加并导入 AddressBookUI
框架并尝试:
So add and import the AddressBookUI
framework and try:
subtitle =
ABCreateStringWithAddressDictionary(placemark.addressDictionary, NO);
这篇关于如何从AddressDictionary获取格式化地址NSString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!