Sometimes Apple Fixes a Bug for You

I encountered a difficult bug in the iOS version of LetterMiner when I made the first playable prototype. After launching the game, there would be a delay in recognizing the first tap of a letter tile. The length of the delay depends on the device. On an iPad 3 there was a 3-5 second delay before the tapped letter tile would be highlighted. On newer devices the delay was about 1 second. After the first letter tile tap, everything worked fine. There were no delays when tapping any other letters.

My first thought about the cause of the delay was the word list hadn’t finished loading. Reading tens of thousands of words from a file isn’t instantaneous. So as an experiment I launched the game and waited 30 seconds before tapping a tile. But there was still a delay on the first tile tap.

The next step was to profile the game using Apple’s Time Profiler instrument. Instruments showed 98% CPU usage on the first tap. When I looked for slow spots in the code, Instruments showed the touchesBegan function, which is the function that handles iOS touches. Looking at the code I couldn’t find anything that would explain why there was a 3-5 second delay on the first touch and no delay on every other touch.

I asked about the delay on Apple’s developer forums. One of Apple’s engineers told me to submit a bug report. I filed the bug report and included my LetterMiner project. Apple said they had no delay when playing the game.

Now I knew I had a difficult problem. If Apple’s engineers couldn’t find the source of the delay, how was I going to do find it? After spending a few more days trying to find the cause of the delay, I decided to move on and continue developing LetterMiner. I could fix the delay problem later.

Moving on ended up being the right decision. When I played version 0.7 of LetterMiner there was no delay on the initial tile touch. I didn’t make any changes in the touchesBegan function or any changes that would remove the delay. Apple must have made an improvement to one of their frameworks I’m using in LetterMiner.

It’s nice to have an issue fixed without having to do anything.