【问题标题】:UIATarget.setLocationWithOptions course not applyingUIATarget.setLocationWithOptions 课程不适用
【发布时间】:2013-02-19 01:28:40
【问题描述】:

我正在尝试通过 UI 自动化自动化用户的路径。理想情况下,MKMapView 中的用户位置将根据我在自动化脚本中说明的航点列表进行更新:

var target = UIATarget.localTarget();

var waypoints = [
    {location: {latitude: 37.33170, longitude: -122.03020}, options: {course: 180}},
    {location: {latitude: 37.33170, longitude: -122.03022}, options: {course: 180}},
    {location: {latitude: 37.33170, longitude: -122.03025}, options: {course: 180}},
    {location: {latitude: 37.33170, longitude: -122.03027}, options: {course: 180}},
    {location: {latitude: 37.33170, longitude: -122.03030}, options: {course: 180}},
    {location: {latitude: 37.33170, longitude: -122.03032}, options: {course: 180}},
    {location: {latitude: 37.33170, longitude: -122.03035}, options: {course: 180}},
    {location: {latitude: 37.33170, longitude: -122.03037}, options: {course: 180}},
    {location: {latitude: 37.33170, longitude: -122.03040}, options: {course: 180}}
];

for (var waypointIndex = 0; waypointIndex < waypoints.length; waypointIndex++)
{
    if (waypointIndex == 0)
        target.delay(5);

    var waypoint = waypoints[waypointIndex];
    target.setLocationWithOptions(waypoint.location, waypoint.options);

    target.delay(1);

    if (waypointIndex == (waypoints.length - 1))
        waypointIndex = 0;
}

位置部分毫无问题地应用,并且用户的指示器沿路径移动。但是,课程选项似乎没有做任何事情。我尝试将90180-903.141.57 作为选项的值,但无济于事。

我也尝试将speed: 8 参数添加到options,没有任何变化。

看到这似乎是only way to simulate headings at allcourse option is totally valid and documented,令人沮丧的是它不起作用。

烦人的 hacky 解决方法:如果您在物理设备上模拟位置(通过 GPX 文件),则设备的旋转工作。这样您就可以模拟路线并获得旋转。

【问题讨论】:

  • 你不需要提供运动速度吗?
  • 不知道为什么我必须这样做,但我会试一试!
  • 我的想法是,如果不实际移动,您将无法获得路线,并且如果您只是更新位置,环境不会为您计算速度。
  • 不要骰子,兄弟。速度似乎不会影响航向。

标签: javascript ios mapkit core-location ui-automation


【解决方案1】:

像这样的坐标在仪器中对我有用:

{location:{longitude:2.105528,latitude:41.414359}, options:{speed:20, course: 290, altitude:200, horizontalAccuracy:10, verticalAccuracy:15}}

试试水平和垂直精度,甚至是高度。

祝你好运!

【讨论】:

    猜你喜欢
    • 2021-04-17
    • 1970-01-01
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    • 2021-04-04
    • 2021-11-27
    • 2015-06-08
    • 1970-01-01
    相关资源
    最近更新 更多