CLLocationManager天在伦敦#39; m

时间:2014-05-26 14:30:06

标签: ios geolocation cllocationmanager

我几天后就遇到了这个问题...不知道为什么这个方法:

- (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的说明:&lt; + 51.50998000,-0.13370000&gt; ...

我不知道发生了什么...... 有关信息,我在iPhone 5上测试,测试它插入Mac并拔下插头......同样的问题仍然存在。

如果你们能帮助我的话!那太棒了!

1 个答案:

答案 0 :(得分:3)

好的,所以这里是因为有些人因为这种错误而像我一样被困:

确保转到产品 - &gt;方案 - &gt;编辑,然后UNCHECK“允许位置模拟”

相关问题