【问题标题】:CCLocationManager says I'm in LondonCCLocationManager 说我在伦敦
【发布时间】: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


    【解决方案1】:

    好的,所以这里只是以防万一有些人像我一样被这种错误卡住了:

    确保转到产品->方案->编辑,然后取消选中“允许位置模拟”

    【讨论】:

      猜你喜欢
      • 2011-02-02
      • 2014-09-26
      • 2012-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多