几天以来我就遇到了这个问题...无法找出原因,但是这种方法:
- (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
}
}
总是说我在伦敦:
当前位置的打印说明:<+ 51.50998000,-0.13370000> ...
我不知道发生了什么事...
有关信息,我正在iPhone 5上进行测试,测试将其插入Mac并拔出...仍然存在相同的问题。
如果你们能帮助我!那简直太好了 !
最佳答案
好的,所以这是为了防止某些人像我一样被此类错误困扰:
确保转到产品->方案->编辑,然后取消选中“允许位置模拟”
关于ios - CLLocationManager说我在伦敦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23872421/