简体   繁体   English

故事板在打开时崩溃Xcode

[英]Storyboard crashes Xcode when opened

Whenever I attempt to open up my storyboard, Xcode crashes with the following error report 每当我尝试打开我的故事板时,Xcode会崩溃,并显示以下错误报告

崩溃报告

The funny thing is, the app works fine in the simulator and builds without errors. 有趣的是,该应用程序在模拟器中工作正常,并且构建没有错误。 What is causing this crash? 是什么导致这次崩溃? I see two possible crashes: 我看到两个可能的崩溃:

Exception reason: UITableView dataSource is not set

, but that shouldn't make the storyboard crash right? ,但这不应该让故事板崩溃吗?

Details:  Failed to compute auto layout status IBLayoutConstraint, IBUIButton, IBUIDatePicker, IBUITextField, IBUIView, IBUIViewController, and IBUIViewControllerAutolayoutGuide.

Which doesn't give much information at all. 这根本没有提供太多信息。

I have been using a storyboard with Xcode 5 for some time, so the question does not appear to be related to moving from Xcode 4 to 5. I can open the storyboard as XML and I can open my iPhone storyboard just fine. 我已经使用Xcode 5的故事板一段时间了,所以问题似乎与从Xcode 4移动到5无关。我可以打开故事板作为XML,我可以打开我的iPhone故事板就好了。

If you are using git, I would recommend reverting to a time before this problem started. 如果您使用的是git,我建议您在此问题开始之前恢复一段时间。

If you are not using git, and you are absolutely sure you did not edit the xml for the storyboard then I would say: 如果您没有使用git,并且您完全确定没有编辑故事板的xml,那么我会说:

1)find the storyboard file using the finder. 1)使用finder找到storyboard文件。 2)copy it to your desktop. 2)将其复制到您的桌面。 3)go back to Xcode and delete the storyboard from your project, select "move to trash". 3)返回Xcode并从项目中删除故事板,选择“移至垃圾箱”。 4)re-import the storyboard file into your project. 4)将故事板文件重新导入到您的项目中。

Ive had similar problems with Xcode 5 and either reverting using git or the steps above usually get me back up and running. 我有与Xcode 5类似的问题,并且要么使用git还是上面的步骤通常让我重新启动并运行。

Exception reason: UITableView dataSource is not set 例外原因:未设置UITableView dataSource

Details: Failed to compute auto layout status IBLayoutConstraint, IBUIButton, IBUIDatePicker, IBUITextField, IBUIView, IBUIViewController, and IBUIViewControllerAutolayoutGuide. 详细信息:无法计算自动布局状态IBLayoutConstraint,IBUIButton,IBUIDatePicker,IBUITextField,IBUIView,IBUIViewController和IBUIViewControllerAutolayoutGuide。

The errors described above lead me to think that one if not all viewcontroller(s) for the items listed above lost their connectivity to viewcontroller.h / viewcontroller.m files. 上面描述的错误让我认为上面列出的项目的一个(如果不是全部)viewcontroller都失去了与viewcontroller.h / viewcontroller.m文件的连接。 I would make sure you have everything wired up correctly, and you can check this by making sure the items in your viewcontroller have a circle in the gutter (next to the line numbers) that is filled in (solid) if the circle is not filled in then it means your items are not wired up to your viewcontroller. 我会确保你把所有东西都正确连接起来,并且你可以通过确保你的viewcontroller中的项目在排水沟(行号旁边)中有一个圆圈(如果圆圈未填充)填充(实线)那意味着你的物品没有连接到你的viewcontroller。 I would post a picture of your .h / .m file of your viewcontroller so we can further investigate. 我会发布你的viewcontroller的.h / .m文件的图片,以便我们进一步调查。

I ended up copying each view controller scene (in XML) into a new storyboard. 我最终将每个视图控制器场景(以XML格式)复制到一个新的故事板中。 Some view controllers could not be copied without the storyboard crashing so I had to recreate about 4 of them, but by and large I got the majority of my work back. 如果没有故事板崩溃,有些视图控制器无法复制,所以我不得不重新创建其中的4个,但总的来说我得到了大部分工作。

What you need to do is reopen the project again in Xcode 5 and then go to the storyboard. 您需要做的是在Xcode 5中重新打开项目,然后转到故事板。 Then at the right side choose for "Identity and type" and then set "opens in" to Xcode 4.6 to be able to open it in Xcode 4.6. 然后在右侧选择“Identity and type”,然后将“open in”设置为Xcode 4.6,以便能够在Xcode 4.6中打开它。 And disable auto layout, somehow when you open it in xcode 5 it asks you to update it, I think you did that without a thought, happened to me as well :) 并禁用自动布局,不知何故,当您在xcode 5中打开它时,它会要求您更新它,我想您没有想到这样做,发生在我身上:)

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM