How to fix WatchKit app WeatherKit issues

I made an iOS app that used WeatherKit. Everything was working as expected and recently I wanted to add an WatchOS component. Because I am adding the watch app to an existing iOS app, I added the target in Xcode and made sure to update the capabilities to the watch app so that it could use WeatherKit too.

Unfortunately I kept running into an auth error where when running the watch app, WeatherKit couldn’t created a jwt and therefore no weather data was making it to the app.

I then went to developer.apple.com and tried to add an identifier for my watch app but it wouldn’t let me. Saying the identifier was invalid. Argh!!! I was so confused.

I thought “maybe I need to wait a couple days for some process to complete”, but still no luck.

Finally I decided I’d make a fresh watchOS/iOS app and plug my weather framework into that, create a new identifier and everything would surely work. Right?!

Well then I get the exact same error in the developer portal! What the hell is going on.

Here is the important part: it turns out that in some cases Xcode automatically creates identifiers in the developer portal. You may see a bunch of identifiers that start with XC.

Then I realized that my watch kit app identifier was there the whole time! …if only the developer portal errors were clearer about why I couldn’t create a new identifier…

Anyways, then I clicked on my watchkitapp identifier, added the capability and the service for WeatherKit and voila, it worked!!!

tl;dr if you’re unable to create an identifier in developer.apple.com, check that the identifier wasn’t already automatically created for you. 🤷🏽‍♂️