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. 🤷🏽‍♂️

How to list installed apps on a iOS simulator

This lists apps from a named simulator, converts to json, then finds non-apple apps.

xcrun simctl listapps "iPad Air (5th generation)" \
| plutil -convert json -o - -- - \
| jq '. | keys | .[] | select(. | startswith("com.apple") | not)'

This requires that you know the name of your simulator and have jq installed.

You can also replace the device name with booted if you want, but I prefer to use the name of the simulator.

Here are the docs for using a simulator name versus booted for simctl.

For subcommands that require a <device> argument, you may specify a device UDID
or the special "booted" string which will cause simctl to pick a booted device.
If multiple devices are booted when the "booted" device is selected, simctl
will choose one of them.

Note: as far as I can tell, there are no docs for listapps or even anything stating its existence in the man page for simctl.

I released my app!

Just over a week ago today, I released my first app to the iOS App Store. If you’re really curious, you can find it here.

Spoiler: it requires an Apple Music subscription to really work.

I have a 1.1 coming soon with some bug fixes and improvements from my small TestFlight community. Send me a message/email/smoke signal if you want to be on future beta tests.

It’s really freeing to be so unknown that I can release something that I’m not entirely happy with and not feel a large amount of stress over it. Maybe one day that will change. Here’s hoping.

P.S. here’s the little website I made for the app.