我用一个例子来使用MKReverseGeocoder来转换lat,长到地址。但是,当我收到数据并试图得到结果时,我收到的字符串如下:
NSString *street = [geocoder.addressDictionary objectForKey:@"Street"];我收到了这样一个地址:“Ng\U00f5381 Nguy\U1ec5n Khang"。
如何将其转换为unicode格式的字符串?
提前谢谢。
发布于 2011-05-04 13:24:03
如果要从MKPlaceMark委托回调中取回MKRevereseGeocoder对象,可以使用以下方法将placemark转换为可读的地址:
NSLog(@"Address of placemark: %@", ABCreateStringWithAddressDictionary(placemark.addressDictionary, NO));您需要将AddressBookUI框架添加到项目中,并且
#import
也是。
我不确定响应是否是unicode,但看起来它在表示placemark中的所有数据方面做了合理的工作。
未经测试,但是
NSLog(@"Address of placemark: %@", [CNPostalAddressFormatter stringFromPostalAddress:placeMark.postalAddress style:CNPostalAddressFormatterStyleMailingAddress]);所需的框架是“联系人”,因此,请将其包括在以下内容中:
@import Contacts;应该是用iOS11.0+做事情的新方法
发布于 2011-11-16 08:45:34
如果要从MKPlaceMark委托回调中取回MKRevereseGeocoder对象,可以使用以下方法将placemark转换为可读的地址:
NSLog(@"The geocoder has returned: %@", [placemark addressDictionary]);
//all elements returned
//you can get some object like coutry ,code ;code country ...
NSLog(@"country ::::%@",[placemark country]);
NSLog(@"countrycode ::::%@",[placemark countryCode]);
NSLog(@"postalcode ::::%@",[placemark postalcode]);
NSLog(@"street::::%@",[placemark thoroughfare]);
NSLog(@"streetinfo::::%@",[placemark administrativeArea]);
NSLog(@"streeteersub ::::%@",[placemark subAdministrativeArea]);https://stackoverflow.com/questions/5604392
复制相似问题