use*_*945 0 iphone objective-c cllocationmanager ios
我正在使用以下代码来获取用户的当前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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1280 次 |
| 最近记录: |