ade*_*190 1 gps emulation gpx ios-simulator
我做了一个.gpx文件来在IOS模拟器上模拟路线,现在我想模拟水平精度我该怎么做?
如下是我的.gpx文件的摘录:
<?xml version="1.0"?>
<gpx>
<wpt lat="-23.772830" lon="-46.689820"/> //how add horizontal accuracy 7 meters for example
<wpt lat="-23.774450" lon="-46.692570"/> //and here horizontal accuracy of 2 metters for example
<wpt lat="-23.773450" lon="-46.693530"/> //and here 19 meters
</gpx>
Run Code Online (Sandbox Code Playgroud)
如果我运行所有gps点返回的水平精度为5米,则可以更改此设置。
小智 5
我是通过viewController的方法调用来做到这一点的(我的是一个按钮,但是显然您可以使用gestureRecognizer或其他方法)。
我将viewController设置为LocationManagerDelegate,但是您可以输入正在使用的委托,而不是“ self”
- (IBAction)simulateAccuracy:(id)sender {
CLLocationCoordinate2D newCoor = CLLocationCoordinate2DMake(someLat, someLng);
CLLocation *newLoc = [[CLLocation alloc] initWithCoordinate:newCoor altitude:someAlt
horizontalAccuracy:TheAccuracyYouWantToTest verticalAccuracy:ditto timestamp:nil];
NSArray *newLocation = [[NSArray alloc] initWithObjects:newLoc,nil];
[self locationManager:myLocationManager didUpdateLocations:newLocation];
}
Run Code Online (Sandbox Code Playgroud)