-[UIView presentScene:]: unrecognized selector sent to instance

有几行代码让程序崩溃,

    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) 


解决方法为:

-[UIView presentScene:]: unrecognized selector sent to instance_第1张图片

将view的 Custom Class 中的Class类由 UIView 换成 SKView;


你可能感兴趣的:(object-c)