在捆绑包NSBundle中找不到名为"Main"的情节提要吗? [英] Could not find a storyboard named 'Main' in bundle NSBundle?

查看:71
本文介绍了在捆绑包NSBundle中找不到名为"Main"的情节提要吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试本地化SpriteKit游戏时,我突然开始收到错误消息:

While trying to localize a SpriteKit game i suddenly started getting the error:

在捆绑包NSBundle中找不到名为'Main'的故事板"

"Could not find a storyboard named 'Main' in bundle NSBundle"

我没有使用情节提要,并且我认为我刚开始开发游戏时实际上删除了该文件. 主情节提要文件基本名称"设置为主"(在工作时也已设置,并且没有情节提要).我删除了该条目,现在该程序仅执行AppDelegate文件,并且实际上停止了.在自动执行根视图控制器而现在不执行根视图控制器之前,缺少什么呢?

I wasn't use a storyboard, and i think i actually deleted the file when i first started developing the game. 'Main storyboard file base name' was set to 'Main' (was set before as well when it worked and there was no storyboard). I deleted that entry and now the program just executes the AppDelegate file and essentially stops. What's missing where before it would automatically execute the root view-controller and now it does not?

我在应用程序委托中尝试了以下操作:

I've tried the following in the app delegate:

*self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
FirstViewController *First = = [[FirstViewController alloc]init];
[self.window setRootViewController: First];
[self.window makeKeyAndVisible];

但是当它移到FirstViewController时,它在这里崩溃了:

but when it moves to the FirstViewController it crashes here:

SKView * skView = (SKView *)self.view;
skView.showsFPS = YES;

但是在我之前不需要先剪掉它的代码以执行根视图控制器之前,就可以了.任何想法可能出了什么问题?这一切都是在模糊本地化,清理,更改语言,删除Localizable.string文件等过程中开始的.

But before i never needed that first snip it of code to execute the root view controller. Any ideas what might have went wrong? It all started during a blur of Localizing, Cleaning, Changing Languages, deleting Localizable.string files, etc....

推荐答案

"...清洁..."

"... 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.

这篇关于在捆绑包NSBundle中找不到名为"Main"的情节提要吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆