I want to develop a game using SpriteKit on the Apple iOS platform. My game has a settings page containing a shortcut, button, table view, ... and a game page. In my test, the first page is the setting and when the player clicks "Start", the game will begin. I donโt know how to go to the game scene, and I donโt know where my problem is, maybe because I am new to SpriteKit. My settings page is the start page in the storyboard, and by default it connected to the GameViewController, and when I click the "Start" button, I get an error message on the last line, and the program stops. I want to load my game scene into a new view, but I have a problem. Here is my code:
-(IBAction)btn_startGame:(id)sender { SKView* skView = (SKView*)self.view; SKScene* obj_gameScene = [MyScene sceneWithSize:skView.bounds.size]; obj_gameScene.scaleMode = SKSceneScaleModeAspectFill; SKTransition *transition = [SKTransition flipVerticalWithDuration:0.5]; [skView presentScene:obj_gameScene]; }
This is mistake:
2016-01-21 06: 06: 40.201 test_myGame [605: 5321] - [UIView presentScene:]: unrecognized selector sent to the instance 0x7fd809fcf570 2016-01-21 06: 06: 40.207 test_myGame [605: 5321] *** Termination application due to the non-displayable exception "NSInvalidArgumentException", reason: '- [UIView presentScene:]: unrecognized selector sent to instance 0x7fd809fcf570'
source share