requestLocation not working reliably

Is anyone else having issues with requestLocation? It works sometimes, but other times the delegate just fails to call either didUpdateLocations or didFailWithError. I've seen this happen on both iOS and watchOS2 - and on both the simulator and on device.


Since it's working sometimes, I assume I have it set up correctly - the delegate is set, authorization has been granted, etc.

Replies

For me it always fails if permission hasn't been yet been granted whereas I expected the call itself to generate the permission alert if necessary. If calling requestWhenInUseAuthorization/requestAlwaysAuthorization first is required, that's totally not obvious and should be documented.

You always have to request permission before checking the user's location, just like on iOS. You should be checking [CLLocationManager authorizationStatus] to make sure it's either kCLAuthorizationStatusAuthorizedWhenInUse or kCLAuthorizationStatusAuthorizedAlways before calling requestLocation.

requestLocation still isn't calling either delegate method for me on the GM. Anyone else having issues?

On watchOS2 I have found it's fairly reliable, but instead of requesting a single location, didUpdateLocations is returning 3-8 locations separately (not in the array).

I'm also seeing instances where this is never calling delegates. Sigh, so many issues even in the GM, I'm strongly considering pushing alll of the heavy lifting for my watch apps pack to the iOS device and using older methods for things like location.

I actually did get it to start working, but it's still pretty unreliable - and when it does work, it's pretty slow. So instead of relying just on requestLocation, I'm also opening the parent app to grab a location from there in case that returns quicker.

I'm doing the same thing. It's like creating a new watchKit extension to handle all the stuff the old one used to.

requestLocation is not working reliably on the watch for me either. I am very suprised that the watch doesnt use the iOS location when connected over bluetooth, maybe this will come in a future version.


I'm also opening the parent app to grab a location from there in case that returns quicker.

Can you tell me how you are achieving this?

My current approach is:

  • On location request use watchConnectivity to send a message to the phone.
  • On the phone, setup a CLLocationManager and call startUpdatingLocation.
  • Call the replyHandler with Lat and Long in the didUpdateLcoations: callback.


However, if the iOS app is terminated before the message call the reply handler is (and I assume didUpdateLcoations: callback) are not called.


Can you advice a better method?

We have an app that was just released that uses requestLocation.


We are seeing the same issue, sadly we didn't see it in development!

We found that users having this issue could delete and reinstall the application to get it working again!