15

我正在尝试通过 UI 自动化自动化用户的路径。理想情况下,an 中的用户位置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;
}

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

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

看到这似乎是模拟标题的唯一方法,并且该course选项完全有效并记录在案,令人沮丧的是它不起作用。

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

4

1 回答 1

2

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

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

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

祝你好运!

于 2013-07-22T14:40:44.403 回答