Request location on the Apple Watch only, without code on the paired phone Request location on the Apple Watch only, without code on the paired phone swift swift

Request location on the Apple Watch only, without code on the paired phone


The user can only grant access to their location on their iPhone. It cannot be done on the Apple Watch. If the iPhone to which the Watch is connected is unlocked, the prompt asking for location usage authorization will be displayed on the phone; you don't need to run any code for this on iOS.

From the App Programming Guide for watchOS: Leveraging iOS Technologies

Be aware that permission for some technologies must be accepted on the user’s iPhone. The user must grant permission to use specific system technologies, such as Core Location. Using one of these technologies in your WatchKit extension triggers the appropriate prompt on the user’s iPhone. Apple Watch also displays a prompt of its own, asking the user to view the permission request on the iPhone. For information about the technologies that require user permission, see “Supporting User Privacy” in App Programming Guide for iOS.


As of watchOS 6.0/ Xcode 11, this is now possible. To enable it, the watch extension target must have the box checked for Supports running without iOS App installation

After checking this setting and rebuilding, my requestWhenInUseAuthorization call showed the prompt on the watch face as expected.

screenshot


I got this to work (using Xcode 10.2.1, iOS 12.4, WatchOS 5.3), but only after adding the necessary keys (NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription) to Info.plist for the iPhone app. Initially I only had them defined in the Watch App Extension, and in that case, the request for location authorization displayed nothing on the phone. Once I added them to the iPhone Info.plist, I got the expected authorization dialog on the iPhone when requesting authorization from the Watch app, without adding any additional code to the iPhone app.

Perhaps this was a bug in previous versions, or perhaps it was the use of deprecated versions of the key names?