-6
我如何提取lat和長從follwoing代碼:如何從下面的代碼中提取lat和long?
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
我想只得到lat和並將它們存儲到變量中。
[CLPlacemark類參考](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLPlacemark_class/參考/的reference.html)。提示:您距離它四次點擊。 – Desdenova