【问题标题】:ios: Debug custom location not workingios:调试自定义位置不起作用
【发布时间】:2013-04-07 01:27:48
【问题描述】:

在模拟器中我设置调试->位置->自定义位置经纬度。

然后在我的代码中:

- (void)updateMap{
    MKCoordinateSpan span;
    span.latitudeDelta = .6;//The amount of north-to-south distance (measured in degrees) to display on the map
    span.longitudeDelta = .6;//The amount of east-to-west distance (measured in degrees) to display for the map region

    MKCoordinateRegion region;
    region.center = _ls.coordinate;
    region.span = span;
    [mapView setRegion:region animated:TRUE];
}

在另一个文件中,我获得了@property (nonatomic, readonly) CLLocationCoordinate2D 坐标;

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{

    //Get the latitude and longitude location
    CLLocation *lastLocation = [locations lastObject];
    _latitude = [[NSString alloc] initWithFormat:@"%f", lastLocation.coordinate.latitude];
    _longitude = [[NSString alloc] initWithFormat:@"%f", lastLocation.coordinate.longitude];
    _coordinate = lastLocation.coordinate;//manager.location.coordinate;
    }

当我运行应用程序时,模拟器一直显示旧金山。任何想法为什么?

【问题讨论】:

    标签: ios xcode debugging ios-simulator


    【解决方案1】:

    搞定了:

    (1)我只需要关闭 xcode 和模拟器并重新加载程序。现在它加载了我的位置。:)

    【讨论】:

      【解决方案2】:

      这是模拟器的默认位置。要模拟位置,请使用 Xcode 窗口中的下拉菜单设置位置或“路径”来模拟移动。

      【讨论】:

      • 这个下拉菜单在哪里?我使用 Simulator Debug 下拉菜单并输入了一个位置的纬度和经度,但我仍然得到旧金山。
      • 它在 Xcode 中,在调试输出窗口上方看到:stackoverflow.com/questions/214416/…
      猜你喜欢
      • 2022-08-13
      • 1970-01-01
      • 2012-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-07
      • 1970-01-01
      相关资源
      最近更新 更多