SpriteKit Bool错误

时间:2013-12-20 05:20:35

标签: ios ios-simulator sprite-kit frame-rate

我的代码出错,我的代码出现问题,所以我有一个设置包,定义SpriteKit是否在场景中显示节点和FPS,这个代码有效,就在我运行时在模拟器中它在最后一行遇到问题,并说它运行theScene的视图控制器有问题并且没有加载我的场景但是当我在模拟器中时我可以点击应用程序它运行都很好,我不知道问题是什么?

另外,当我从主屏幕返回应用程序时(应用程序运行时),有没有办法重置skView是否显示FPS计数?

- (void)startScene
{
    SKView *skView = (SKView *)self.view;
    if(!skView.scene)
    {
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        BOOL statsForNerds = [defaults boolForKey:@"myKeyName"];
        if (statsForNerds)
        {
            skView.showsFPS = YES;
            skView.showsNodeCount = YES;
        }
        else
        {
            skView.showsFPS = NO;
            skView.showsNodeCount = NO;
        }
        MyScene *theScene = [MyScene sceneWithSize:skView.bounds.size];
        theScene.scaleMode = SKSceneScaleModeAspectFill;

        // Present the scene.
        [skView presentScene:theScene];
    }
} //Here's the problem line (According to Xcode)

1 个答案:

答案 0 :(得分:0)

That不是错误,Xcode会遇到您设置的断点。

断点在执行突出显示的行之前停止执行正在运行的程序,允许您查看变量的值并逐步调试代码以进行调试。请参阅:https://developer.apple.com/library/ios/recipes/xcode_help-source_editor/Creating,Disabling,andDeletingBreakpoints/Creating,Disabling,andDeletingBreakpoints.html