Getting location in an Apple Watch widget

I have a watchOS WidgetKit complication that needs the user's location to show the nearest transit station, but the widget never gets location permission and CLLocationManager times out.

Setup:

  • NSWidgetWantsLocation = YES in Widget Extension's Info.plist
  • NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription in Widget Extension's Info.plist
  • Watch App successfully has location authorization

Problem:

  1. The system never presents a location permission prompt for my widget. Apple's own World Clock widget does get one on watchOS (see screenshot) — I can't figure out what triggers it.
  2. When the widget tries to get location via CLLocationManager, the request times out and never returns a location.

Questions:

  1. What triggers the system location prompt for a watchOS widget? Is NSWidgetWantsLocation sufficient or is something else required?
  2. Why would CLLocationManager time out and never return a location inside a widget extension? Is there a specific pattern required for requesting location in a WidgetKit timeline provider?

Screenshots

Sorry for swedish, but it says "Do you allow widgets from World Clock to use your location services?"

Getting location in an Apple Watch widget
 
 
Q