UIATarget.setLocationWithOptions课程不适用

时间:2013-03-04 20:20:07

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

我正在尝试通过UI Automation自动化用户的路径。理想情况下,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 all,而course option is totally valid and documented,它令人沮丧的是它无效。

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

1 个答案:

答案 0 :(得分:2)

在这些工具中协调这样的工作:

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

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

祝你好运!