我可以更改设备上的位置以测试用户的位置吗?

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)

Ben*_*n S 5

您无法模拟物理设备上的位置.

但是,可以在模拟器中测试您的应用程序,并声称它位于您想要的任何位置.