如何从以下代码中提取经纬度:
CLGeocoder *geocoder = [CLGeocoder new];
[geocoder geocodeAddressString:city completionHandler:^(NSArray *placemarks, NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
}
if ([placemarks count] > 0) {
CLPlacemark *placemark = [placemarks lastObject];
NSLog(@"Location is: %@", placemark.location);
}
从 nslog 输出我得到:
Location is: <+45.46368100,+9.18817140> +/- 100.00m (speed -1.00 mps / course -1.00) @ 25/09/2013 11:04:20 British Summer Time
我只想获取纬度和经度并将它们存储到变量中。