CLLocationCoordinate2D を取得する適切な方法は何ですか?
.h:
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
.m
//Called when the location can be obtained
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{
//Get the latitude and longitude location
CLLocation *lastLocation = [locations lastObject];
_latitude = [[NSString alloc] initWithFormat:@"%f", lastLocation.coordinate.latitude];
_longitude = [[NSString alloc] initWithFormat:@"%f", lastLocation.coordinate.longitude];
}
これですか:
_coordinate = lastLocation.coordinate;
またはこれ:
_coordinate = manager.location.coordinate;