【发布时间】:2014-05-26 14:30:06
【问题描述】:
几天前我就遇到了这个问题......无法弄清楚为什么但是这个方法:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
long now = [[[NSDate alloc] init] timeIntervalSince1970];
//avoid cached locations
if(abs([newLocation.timestamp timeIntervalSinceNow]) > 15.0f)
{
return;
}
//avoid more the 1KM location
if(newLocation.horizontalAccuracy > 1000 || newLocation.horizontalAccuracy < 0)
{
return;
}
//if we already located, no need to go any further
if(alreadyLocated)
{
[locationManager stopUpdatingLocation];
return;
}
alreadyLocated = YES;
[self stopLocating];
[[SPPreferenceHandler getInstance] setValue:[NSNumber numberWithLong:now] forKey:LAST_LOCATION_UPDATE];
CLLocation *currentLocation = newLocation;
if (currentLocation != nil) {
//blabla some code
}
}
总是说我在伦敦:
currentLocation的打印说明:...
我不知道发生了什么... 有关信息,我正在 iPhone 5 上进行测试,测试它插入 Mac 并拔下电源...同样的问题仍然存在。
如果你们能帮帮我!那太好了!
【问题讨论】:
标签: ios geolocation cllocationmanager