根据我的应用程序要求,我们会进行跟踪,并且工作正常。但是当我启用GPS服务并且从未移动并将iPhone放在桌面上1小时之后我出现了30分钟的旅程但是我的更新位置代表从未打过电话时出现了问题。下面是我的代码:
locationManager = [[CLLocationManager alloc]init];
locationManager.delegate = self;
locationManager.distanceFilter = 150.0f;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")) {
setPausesLocationUpdatesAutomatically:NO];
}
答案 0 :(得分:0)
编写此代码:
[locationManager startUpdatingLocation];
&安培;也写下他们的代表方法:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSMutableString *latString = [NSMutableString stringWithFormat:@"%f",newLocation.coordinate.latitude];
NSMutableString *lngString = [NSMutableString stringWithFormat:@"%f",newLocation.coordinate.longitude];
}