且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在捆绑包NSBundle中找不到名为"Main"的情节提要吗?

更新时间:2023-11-18 16:12:04

"...清洁..."

"... Cleaning..."

SpriteKit应用程序模板包括Main.storyboard&用作GameScene加载到的视图.您很可能已将其卸下,并且可以正常工作,直到很晚才清理项目为止.至少根据我的经验,在删除情节提要或其他资源后,您真的想立即进行清理和构建,以发现是否损坏了某些内容,因为它们似乎在删除后会在生成的包中保存一段时间.

The SpriteKit app template includes a Main.storyboard & is used as the view that the GameScene is loaded into. It's quite possible that you removed it and went on working fine until cleaning the project much later; at least it's my experience that after removing a storyboard or other resource you really want to do a clean and a build right away to find out if you broke something, as they seem to end up in the generated bundle for a while after being deleted.

您当前的代码创建了一个FirstViewController,但是我看不到您是否在init方法中正确处理了所有布局,但是由于崩溃了,也许不是吗?

Your current code creates a FirstViewController, but I can't see if you handle all the layout properly in the init method, but since you're crashing, maybe not?

我喜欢情节提要,所以如果您是我,我会创建一个新的spritekit游戏项目,以便您可以从其中抓取Main.storyboard,但是如果您真的想修复自己拥有的代码,我想我们可能需要看FirstViewController.m

I like storyboards so if I were you I'd create a new spritekit game project so you can grab the Main.storyboard out of it, but if you'd really rather fix the code that you have I think we might need to see FirstViewController.m

此外,当调试器崩溃时,您在调试器中收到的消息也可能有助于获得更好的答案.

Also, what message you get in the debugger when it crashes would probably be helpful to getting a better answer as well.