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

Partial Solar Eclipse 2024

I live in South Carolina so I wasn’t in the path of totality, but I still wanted to see the eclipse. Unfortunately I forgot to get glasses, but I still wanted to see it. I was reading about when it would be happening and I learned that I could make a pinhole projector out of some boxes, tape, and a piece of paper.

pinhole project made of diaper boxes sitting in my driveway

projection of the eclipse from my pinhole projector.

shadows produced by a tree during the eclipse.

It's a curse to know how to make software

Over dramatic title, but there is some truth to it.

As a software developer I know how to make things. Maybe not super well, but I can get there. I also like to pay for software that others make.

The thing I run into is that I sometimes feel like I can make the thing and so I do. There are some benefits of this.

  1. I save some money
  2. I learn how to make a thing
  3. It’s fun to reverse engineer stuff

The problem with this is that I have a ton of tiny little projects that don’t work quite as well because I get bored with the fine tuning and polishing. And then I have something that works well enough, but not as well as the original thing I based my software on.

This whole thing reminds me of when people are doing home improvement projects and there is an option to pay someone to do it, but someone feels like they can do it themselves.

Maybe this isn’t a problem or a curse at all, just a way to spend time working on something.

Some sort of hawk at Middleton Place

These are from a little over a month ago, but I was able to sit here and film this bird for over 2 minutes. It was so cool to see the wind moving its feathers and how calm and focused it was (my words, I don’t know what it was thinking).

I’m so thankful to have moved somewhere that is warmer than where I used to live.

How to fix zsh completions

I was trying to add some zsh completions and I couldn’t figure out why they weren’t working. I had added them into a folder that I was running autoload on, but I still couldn’t get it to work.

I found this stackoverflow post and it saved me.

Here is what my .zshrc looks like now.


The code


autoload -Uz compinit && compinit

# enable case insensitive tab completion
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
fpath=(/usr/local/share/zsh-completions $fpath)
source $DOTFILES/zsh-completions/_arduino_cli

NOTE: I set up environment variables for important paths hence the $DOTFILES line.

So what is this doing?

I think the gist of this is autoload compint (I was already doing this) and then source your completion files (I was not doing this).

I’ll probably later write a nice loop for this if I end up with more completions.

Back to the beach.

My family and I recently took a trip to Missouri after having moved to South Carolina about six months ago.

It was nice to see family and friends.

It was also nice to have a reminder for why we moved here in the first place.

No matter where you go or what you do there will be trade-offs. When I go to the beach and see my daughter’s eyes light up, I know that I’m happy with the trade-offs we’ve made to get here.

My oldest daughter standing in the wake

A userscript to add links to headers in articles

I read a lot of things on the internet and sometimes I want to save my position for later. Many websites use HTML section heading tags to mark sections of their content. Many of these websites attach an id attribute which is nice because if you paste that id into the url like https://nickkaczmarek#some-id you can link to the spot in the website that contains that id.

Some websites go even further and provide an anchor to that section heading and it makes it really easy to just click that value and then if the page is reloaded you will stay at that spot. This website by Sarun Wongpatcharapakorn is a great example of a site that provides clickable links to parts of the article.

Unfortunately many websites either don’t have these id attributes (for instance my website 😬) or they do, but you can’t click on them. If you’re particularly pioneering you can inspect the web content, grab the id, and paste it in the address bar in your browser. As you can see that is a lot of work and also assumes you are even familiar with how to do that.

I have been doing the above for a long time and finally I decided I would try to make this better with some automation. So I wrote a userscript to do this for me.

There are many userscript extensions out there. I use one for safari called Userscripts and you can use this on a Mac and an iPhone. There are also Chrome and Firefox extensions with names like TamperMonkey, GreaseMonkey, etc. They all more or less work the same.

# The Code

It’s not perfect, but it has worked on a number of websites for me including wikipedia (where I want to use this most).

# What it looks like when it’s off:

screenshot of website without my userscript

# What it looks like when it’s on:

Screenshow of website with my userscript

How to use git to revert changes to individual files or foldersvidual

This is something I need to do often and often forget how to do it.

tl;dr: git checkout main <filename>

Disclaimer:

Like anything else this is nuanced and there are other ways to accomplish this as well as other arguments to revert to a point in time instead of just the tip of main.

Revert a commit

If you want to a revert a whole commit you can do git revert <hash>.

Revert a file or folder

But what if you want to revert one file or one folder to what is in your main branch?

You can do git checkout main <filename>.

An example repository where you have this structure:

repo-root
├── main.swift
├── Service
│   ├── Service.swift
│   └── README.md
└── start-docker.sh

You could do git checkout main main.swift to undo main.swift to where it was on main.

Or you could do git checkout main Service to undo the whole directory to where it was on main.

Why would I want to do this?

The situation where I found this useful was that I had a long running branch and I wanted to merge part of the code into main. The problem was there were a handful of files that I did not want to merge to main.

I could have reverted the commits where they were made, but this branch had a lot of commits and I wasn’t sure exactly when these changes were made.

I also could have manually changed them back to what they were in main, but this was a better solution for my use case.

Maybe you’ll find it useful as well.

Tíos holding me as a baby.

My tío David (RIP) and my tío Jesse holding me when I was a baby. Taken sometime in 1993.

My grandma sent me this the other day and I’m sad that I’ll never get to meet my tío David. He died of AIDS related complications before I turned 2. I wonder what he would think of the world as it is now.

My tíos holding me when I was a baby.

Angel Oak, South Carolina.

From Wikipedia on the Angel Oak:

Angel Oak is a Southern live oak located in Angel Oak Park on Johns Island near Charleston, South Carolina. The tree is estimated to be 400–500 years old. It stands 66.5 ft tall, measures 28 ft in circumference, and produces shade that covers 17,200 square feet. Its longest branch distance is 187 ft in length. Angel Oak was the 210th tree registered with the Live Oak Society.

This thing is absolutely gigantic.

Picture of the Angel Oak in South Carolina.