模拟低和高Gps准确度

时间:2012-10-30 19:45:49

标签: gps ios-simulator emulation gpx

我做了一个.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> 

如果我运行所有gps点返回5米的水平精度,我可以改变它。

1 个答案:

答案 0 :(得分:4)

我是通过viewController的方法调用完成的(我的是一个按钮,但显然你可以使用gestureRecognizer或其他)。

我将viewController设置为LocationManagerDelegate,但您可以使用#34; self&#34;

来代替您使用的代理
- (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];
}