有几行代码让程序崩溃,
SKView* skView = (SKView*)self.view;
FYFScene* scene = [FYFScene sceneWithSize:skView.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;
if (skView == nil) {
NSLog(@"skview nil");
}
[skView presentScene:scene];
异常信息为:
-[UIView presentScene:]: unrecognized selector sent to instance 0x7ff843c2fa20
2014-12-07 09:19:47.876 my2048[460:7638] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView presentScene:]: unrecognized selector sent to instance 0x7ff843c2fa20'
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
解决方法为:
将view的 Custom Class 中的Class类由 UIView 换成 SKView;
本文介绍了一段导致程序崩溃的SpriteKit代码及其错误信息。通过更改视图的CustomClass中的Class类从UIView到SKView,成功解决了-[UIView presentScene:]未识别选择器的问题。
381

被折叠的 条评论
为什么被折叠?



