Skip to main content

Check Sim Games

My First LetterMiner Crashing Bug

I was recently reflecting on LetterMiner’s development. A pleasant surprise was LetterMiner hadn’t crashed when someone was playing. I reflected too soon.

As I was trying to fix another bug, I discovered my first crashing bug. I was working on highlighting the tiles the player can click (or tap) to make the game easier to figure out for new players. The bug was that the highlighting was being removed every other click. To test this I was clicking outside the game board. The following screenshot shows what the in-game user interface currently looks like:

As part of my every other click test, I clicked the Word Score phrase in the screenshot. Xcode threw me into the debugger, and the game crashed. I also crashed the game by clicking the phrases Proposed Word, Score, and Level. What was going on?

The problem was that those labels did not have a name in Xcode’s scene editor. I didn’t give them names because the labels weren’t used in my game code. My code to handle button clicks relied on the name. Since the labels I clicked had no name, the game crashed.

The bug was pretty easy to fix. Go to the scene editor and give each label a name. I also changed the code to not rely on the name to avoid future crashes. What surprised me was I hadn’t encountered the bug before. I had played various builds of LetterMiner for months. I had friends and family try the game out too. I can’t believe I hadn’t tried clicking each label in the user interface. I can’t believe nobody accidentally clicked one of the labels.

I’m glad I found the bug before I released LetterMiner to external testers on iTunes Connect.