gps - 模拟低和高 Gps 精度

标签 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 米的水平精度,否则我可以更改此设置。

最佳答案

我使用来自 viewController 的方法调用来做到这一点(我的是一个按钮,但显然你可以使用gestureRecognizer 或其他什么)。

我将我的 viewController 设置为 LocationManagerDelegate,但是您可以输入您正在使用的委托(delegate)而不是“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];
}

关于gps - 模拟低和高 Gps 精度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13146553/

相关文章:

java - 纬度/经度返回 0

android - 使用 Android : which version to use? 检索 GPS 坐标

Java:具有数百万项的 HashMap 性能与 if-else 搜索数值范围

c# - 如何在不从 Visual Studio 中运行的情况下在本地运行 Azure worker 角色

android - 为什么安卓模拟器很慢?

android - GPS 在异步任务中不工作

android - GPS 精度圆(以米为单位)与 map 上的一条线相交

ios - 为什么 iPhone 5.1 Simulator 提供的调试信息少于 4.3 Simulator?

iOS 模拟器在 Apple M1 上滚动太快

iphone - 无法启动模拟应用程序: iOS Simulator failed to install the application