The curious case of the GameplayKit Crashes in the night

Screen Shot 2015-06-12 at 5.19.52 AM

There’s something oddly satisfying in crashing Apple’s sample code. Perhaps I shouldn’t say “oddly” because I earned that satisfaction with many hours of head-desking and line-by-line review until I finally realized that GameplayKit simply doesn’t work on the iPhone 5 simulator while it does on the iPhone 6 one.

My moment, that epiphany, was hard won and not nearly as joyful as going into Apple’s overly convoluted sample and crashing it over and over and over. Each EXC_BAD_ACCESS became a liberating expression of righteous indignation.

It’s pointless to try to explore new technologies on OS X unless you’re willing to use a beta IDE with a beta SDK to create beta code in a beta OS. The iPhone, simulator and beta firmware, offers a target that allows you to stay in Yozeland, while tasting the delights of the Elk. Playing with the sim keeps things immediate, convenient, and a little dangerous.

I have now spent significantly more time debugging non-existent issues in my GameplayKit code than I have invested in trying to learn the APIs. I think this means I’m entitled to a bit of a grudge match.

The GameplayKit library is moderately interesting. I’ll probably end up using it. But by heavens, I wish I hadn’t  have wasted all that time for a fruitless bug that ended up not being part of my understanding of the technology.

I’m adding this write-up to my blog so anyone googling GameplayKit Crash may learn from my experience. My web searches yesterday all came up dry. The issue occurs when you add behaviors to agents and then update the clock (as in the screenshot).

One Comment

  • Ha! My first experience with the GameplayKit demo code was that it utterly crashed on Mac builds. After the initial debugging I thought “how could they let this obvious bug pass”? Then I realized that I needed to be on OS X 10.11 to run OS X 10.11 framework code. D’oh!

    Let me know if you need any help on GameplayKit over at – I intend to document and extend GameplayKit and will provide interactive demos and am looking for anything developers struggle to understand conceptually, or how to best implement given tasks, etc. etc.

    PS: “Moderately interesting” is the understatement of the year.