Go to your Storyboard, select your UIViewController that contains the SpriteKit game, and select the view from left menu:
Now go to Identity Inspector and make sure Class is SKView
and not UIView
:
You should now be able to compile this part of code from your UIViewController
:
// Configure the view.
SKView * skView = (SKView *)self.view;
Or in Swift:
let skView = self.view as! SKView
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…