Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIATarget.setLocationWithOptions course not applying

I'm attempting to automate the path of a user via UI Automation. Ideally, the user location in an MKMapView would update according to the list of waypoints I've explicated in the automation script:

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;
}

The location portion applies without issue, and the user's indicator moves along the path. However, the course option doesn't seem to be doing anything. I've tried 90, 180, -90, 3.14, and 1.57 as values for the option, to no avail.

I've also tried adding in the speed: 8 parameter to options, with no change.

Seeing as how this appears to be the only way to simulate headings at all, and that the course option is totally valid and documented, it's frustrating that it isn't working.

Annoying hacky workaround: If you simulation location (via GPX file), on the physical device, the device's rotation works. This way you can simulate a route and get rotation.

like image 339
Patrick Perini Avatar asked Mar 04 '13 20:03

Patrick Perini


1 Answers

Coordinates like this work for me in instruments:

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

Give a try to horizontal and vertical accuracy, and maybe even altitude.

Good luck!

like image 78
The dude Avatar answered Oct 16 '22 19:10

The dude