我想要在应用程序启动时简单地获取 lan、lon 值,我不想在改变我的位置时每秒更新这些值。我正在使用这段代码:
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager startUpdatingLocation];
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
latValueNSString = [NSString stringWithFormat: @"%f",newLocation.coordinate.latitude];
lanValueNSString = [NSString stringWithFormat: @"%f",newLocation.coordinate.longitude];
}
但问题是我无法传输这些值,因为每毫秒它一次又一次地设置它......我怎么能只设置那些值,就是这样?