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).