Issue tracking location on Apple Watch
Asked Answered
W

0

11

I have built an Apple Watch App which uses CLLocation to track the users location. The idea of the app is for it to work using the built in GPS and not need the phone.

When I run the watch app it prompts me to give the various permissions which have to be granted from the phone app.

If I do this and then start tracking on the watch I get an initial call to

- (void)locationManager:(CLLocationManager*)manager didFailWithError:(NSError*)error

which is quite normal, I just start tracking again. I then get a handful of calls to

- (void)locationManager:(CLLocationManager*)manager didUpdateLocations:(NSArray*)locations

But then it just stops receiving updates.

If I run a full track on the iPhone and then run the track on the Watch the tracking works fine.

Tests done:

  • checked permissions for both workout and location are set correctly on the iPhone
  • if on the track that is not receiving updates you deny permission to location services on the phone and then turn it back on again it again calls the two methods above a handful of times and then stops. So everything is staying in memory
  • tested on a running app, 'Pear', and seemed to get the same bug, that is it doesn't track location on the watch on the first run.

I think it's most likely an Apple bug, but I'm hoping someone here can somehow point me in a direction that I may have missed.

Withdrawn answered 23/1, 2017 at 17:49 Comment(1)
My work around: in the iPhone app, where I ask for permission to track location, when they grant I start updating locations and then instantly turn it off. This does whatever is needed so that it works the first time on the Watch.Withdrawn

© 2022 - 2024 — McMap. All rights reserved.