我正在使用以下代码来获取用户的当前 lat loc。我想更改设备上用户的 currentLocation 以查看地图是如何填充注释的。我想模拟应用程序测试人员在我所在国家/地区的设备上遇到的问题。对他来说,地图不会加载注释,而对我来说,它在模拟器和设备中运行良好(我们'正在使用相同的设备型号等)。我确实尝试将 设置currentUserLatitude currentUserLongitude
为我的测试人员的值,但地图添加了对我来说很好的注释。
-(void)loadMap{
CLLocationCoordinate2D coordinate = [self getLocation];
currentUserLatitude = [NSString stringWithFormat:@"%f", coordinate.latitude];
currentUserLongitude = [NSString stringWithFormat:@"%f", coordinate.longitude];
NSLog(@"*dLatitude : %@", currentUserLatitude);
NSLog(@"*dLongitude : %@",currentUserLongitude);
}
-(CLLocationCoordinate2D) getLocation{
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.distanceFilter = kCLDistanceFilterNone;
[locationManager startUpdatingLocation];
CLLocation *location = [locationManager location];
CLLocationCoordinate2D coordinate = [location coordinate];
return coordinate;
}