Scene freezes after clicking on iAD or AdColony V4VC ad

So I'm working on a little iOS game project and I decided to implement ads to try to make a little side money (yay paying for university...) Well let me tell you, SpriteKit and Modal Views don't get along. I just spent a good 3-4 hours tracking down a pain in the butt bug. So all the tutorials tell you to create a SpriteKit project which attaches and SKView to your ViewController. You then do what you will with that View, such as presenting a scene. My main problem was with click on an AdColony V4VC add I had implemented. Everytime I clicked on it, when I got back to my menu, the scene would be totally frozen! It wasn't paused though, because events were happening as if I'd click and interacted with the scene (yay NSLog), but the display was stuck. After perusing many an unanswered question on StackOverflow I came to find a semi-solution. Turns out, AdColony uses a ModalViewController much like iAd to display the ads. It finds the current view on the stack and then uses that to display the modal. Well, SKView and ModalViews aren't compatible because... I don't know why, but anyways... So I replaced the top level SKView with a UIView, then added the SKView as a subview (with all my interactions dealing with this child) and viola. No freezing. So, lesson learned. If your app is freezing and deals with ads or modals as well as SpriteKit, avoid interactions with the SKView and use a parent UIView... It's a hack, but if you work at Apple or on SpriteKit, maybe you can fix it! If you have any ideas as to what this is, leave a comment. Or if you find a better solution.

Written on August 22, 2014