当我看着苹果文档时,我有点困惑。iOS 4.2支持CLGeocoder吗?
- 一方面它们具有指示CLGeocoder可以从iOS 5的起使用的语句。
- 他们有这样的语句另一方面:“有关的iOS 4.1上运行的应用和早期,您使用MKReverseGeocoder类必须执行反向地址解析请求”
- 那么关于4.2起的范围?它可以支持CLGeocoder吗?
没有人有通过自己的亲身体验与iPhone 4.1 <安装在那里他们想通了,如果CLGeocoder将工作或没有< 5.0版本的答案吗?
当我看着苹果文档时,我有点困惑。iOS 4.2支持CLGeocoder吗?
没有人有通过自己的亲身体验与iPhone 4.1 <安装在那里他们想通了,如果CLGeocoder将工作或没有< 5.0版本的答案吗?
目前我打电话 [CLGeocoder类] instancesRespondToSelector:@selector(reverseGeocodeLocation:completionHandler :)]
这总是在设备返回false低于5.0
我仍然试图找出原因为该文件声明其支持4.1以后。
下面是从Location Awareness Programming Guide报价:
在iOS中,您可以使用该CLGeocoder或MKReverseGeocoder类 处理反向地理编码请求。 CLGeocoder是首选的 类,可用于iOS 5.0及更高版本。但是,如果您的 应用程序必须在早期版本的iOS上运行,则可以使用 MKReverseGeocoder类。
MKReveresGeocoder仍然存在于5.0中,但不推荐使用。也就是说,您仍然可以使用它来简化对代码中多个iOS版本的支持。
谢谢,我的问题是基于实际指导。我问,是否有可能在4.1和5.0之间的sdks中存在CLGeocoder,请更仔细地看看我的问题,并告诉我。 – pulkitsinghal 2012-01-08 22:27:15
我不确定。但是,所有文档(位置感知指南和CLGeocode类参考)均在多个位置显示,它只能从5.0开始提供。只有一个地方引用了模棱两可的陈述。但你为什么在意? – fishinear 2012-01-09 13:07:30
如果有机会,不仅5.0,但4.2和以上也有它,我想只与CLGeocoder一起工作。在此之前我不在乎支持任何事情。 – pulkitsinghal 2012-01-09 16:51:24
- (IBAction)geoCodeLocation:(id)sender{
[self.geoCoder reverseGeocodeLocation: locationManager.location completionHandler:
^(NSArray *placemarks, NSError *error) {
CLPlacemark *placemark = [placemarks objectAtIndex:0];
NSLog(@"placemark %@",placemark);
//String to hold address
NSString *locatedAt = [[placemark.addressDictionary valueForKey:@"FormattedAddressLines"] componentsJoinedByString:@", "];
NSLog(@"addressDictionary %@", placemark.addressDictionary);
NSLog(@"placemark %@",placemark.region);
NSLog(@"placemark %@",placemark.country); // Give Country Name
NSLog(@"placemark %@",placemark.locality); // Extract the city name
NSLog(@"location %@",placemark.name);
NSLog(@"location %@",placemark.ocean);
NSLog(@"location %@",placemark.postalCode);
NSLog(@"location %@",placemark.subLocality);
NSLog(@"location %@",placemark.location);
//Print the location to console
NSLog(@"I am currently at %@",locatedAt);
//Set the label text to current location
[locationLabel setText:locatedAt];
}];
For more see property of CLPlacemark Link : http://developer.apple.com/library/ios/#DOCUMENTATION/CoreLocation/Reference/CLPlacemark_class/Reference/Reference.html (Support in iOS 5.0 because in previous MKReverseGeocoder is deprecated)
感谢有关设备实际使用情况及其结果的信息。是的,文档是什么必须是重击然后:( – pulkitsinghal 2012-02-17 17:10:47