Swift with SpriteKit problems on Mac OS 10.9 and an easy fix.


When I did the first ( and currently only ) part of my Swift with SpriteKit tutorial series I ran into a crash problem with the default game template.  In Googling around and looking at the Mac password protected developer forums, I notice I am by no means alone.  Even a comment in the earlier tutorial part mentioned encountering the problem and said it was tied to Mac OS 10.9.  I can confirm on my 10.10 install, everything works correctly, for me it is only in 10.9 that I have a problem.


It’s pretty simple to re-create, when running Mac OS 10.9, create a simple project using the game template and Swift as your language ( the Objective-C template works just fine ), like this one:




Then when you run it:



EXC_BAD_ACCESS Code=1 address=0x10.  


Fortunately I have discovered a very simple fix.  In Xcode, open up the generated sks file, GameScene.sks:



Make sure the Utilities panel is visible:



Now from the Object library, drag an Empty Node to the editor window, like so:



And now, if you run the game it should work:



My guess is the scene file included in the Swift Spritekit template is corrupted.  By adding a node and saving it, it seems to fix the corruption.  By the way, you can delete the empty node now and it will continue to work.


Hope that helps some of you, at least till Apple fix the bug.






Scroll to Top