我有以下三行代码:
self.tapToFlyLabel = [SKSpriteNode spriteNodeWithImageNamed:@"tap_to_fly"];
self.tapToFlyLabel.position = CGPointMake(self.size.width/2, self.scene.size.height-250);
[self addChild:self.tapToFlyLabel];
在“iPhone Retina 3.5”,“iPhone Retina 4.0”模拟器以及iPhone 5设备iOS 7上运行时,一切运行正常。
但是,它在64位iPhone视网膜上崩溃,并显示以下错误:
*** Terminating app due to uncaught exception 'Attemped to add nil node', reason: 'Attemped to add nil node to parent: <SKScene> name:'(null)' frame:{{0, 0}, {568, 320}}'
飞机坠毁的原因是什么?有什么办法解决吗?谢谢!
最佳答案
我在应用程序中遇到此错误,我发现如果您有一个属性声明,请尝试不要使用弱的setter属性,而如果您的值随时间变化,则可以使用keep。这使我的应用程序可以在x64设备和普通设备上的iOS 7/8上运行。希望能帮助到你。
关于ios - '尝试添加nil节点',原因:'尝试将nil节点添加到父节点:<SKScene>名称:'(null)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21747339/