WatchOS and location entitlement

Viewed 595

I've been working on adding a watchapp to a fitness tracker I already have in the app store. I've been able to load it onto my physical phone and watch without trouble in the past.

I've recently added Location tracking to the watch app, so that I can track the path the user has run/biked and show it to them on the phone when they review the workout. Since doing that, I'v been getting errors from Xcode when I try to load the app to my phone; I think these are expected errors, but I'm having trouble understanding from the docs/interface of Xcode and developer.apple.com where to make the fix.

errors from xcode

I've added the entitlement in the watch app entitlements file:

entitlemnents file

As the error says, I've switched to manual signing and generated a new provisioning profile, but I get the same error. I don't see a place to add a location capability in the provisioning profile in developer.apple.com:

enter image description here enter image description here

It seems like the only way for the provisioning profile to get the entitlement is from Xcode, since there's not a place to add it in developer.apple.com? That seems wrong, and isn't working in any case. I'm not finding help for my case in the Xcode docs (or I'm looking in the wrong place). Any help would be greatly appreciated.

2 Answers

I am using location services on iOS and watchOS, but I have nothing related to it in both entitlement files. The docs say:

Set entitlement values in order to enable iCloud, push notifications, Apple Pay, and App Sandbox.

They don’t mention location services.

So it might be enough to delete the Location entitlement, and enable automatic signing again.

Of course, you had to set in your iOS info.plist, as required, NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription, and in your watch extension info.plist NSLocationWhenInUseUsageDescription.

Are you using latest Xcode? Did you set the entitlement in the target menus? They all have toggles now, from what I remember. Once you do that, normally Xcode can resolve signing issues for you. If you look at the signing section in Xcode, does it indicate a signing problem there? (And have you restarted Xcode at least once while trying to resolve the signing problem?)

Note that the location entitlement should be on your WatchKit Extension, not on the Watchkit App.

Have a look at the Capabilities tab (it is the one for control of Entitlements, so you do not have to edit the plist directly.)

Have you tried creating a new project as a test to see if that works? Your screenshot does not match target naming of what I see in Xcode for a WatchKit App. In Xcode 10.1, the WatchKit App plist editor will show 'app name' WatchKit App and the extension plist editor shows 'appname' WatchKit Extension. I see your screenshot showing 'blank' Watchapp Extension. Possibly you edited the project name and that is not an issue? Another thing to verify is that the plist is not corrupt.

Related