iOS 7 - 无法实例化默认视图控制器 [英] iOS 7 - Failing to instantiate default view controller

查看:92
本文介绍了iOS 7 - 无法实例化默认视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在新创建的应用程序中使用Xcode 5,当我刚创建它时,我去运行按钮e点击它,然后项目构建但它没有显示在iOS模拟器中我得到以下消息:

I am using Xcode 5 in a newly created app and when I just create it I go for the run button e click on it, then the project gets built but it does not show in the iOS Simulator and I get the following message:

 Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' - 
 perhaps the designated entry point is not set?

我当然用Google搜索了它,并且每个人都指出这种情况正在发生,因为XCode不知道但哪个视图控制器是初始控制器。但奇怪的是,我创建了应用程序作为基于页面(也尝试过单视图和选项卡式应用程序选项)应用程序,XCode已经为它定义了一个故事板。

I've Googled about it of course and everybody points out that this is happening because XCode does not know yet which view controller is the initial one. But the weird thing is that I created the app as a page based (also tried single-view and tabbed app options) app and XCode already had defined a Storyboard for it.

此外,当我转到项目的主界面选项时,故事板(由Xcode本身命名为Main)被设置,并且在Storyboard中,我的视图控制器被设置为初始视图控制器

Also, when I go to the main interface option of the project the storyboard (named "Main" by Xcode itself) is set, and in the Storyboard, my view controller is set as the "Initial View Controller"

出了什么问题?

推荐答案

所以这也发生在我身上。我检查了50次并检查了我的初始视图控制器,相信我。它突然发生了。那我是怎么解决的呢?

So this also happened to me too. I checked 50 times and my "Is Initial View Controller" was checked, believe me. It happened out of the blue. So how did I fix it?


  1. 在项目中创建一个新的Storyboard,将其命名为Main_iPhoneV2(或iPadV2,具体取决于您原来的故事板样式)

  2. 打开破碎的故事板,单击白色区域中的任意位置,然后按命令-a,然后按命令-c(全选并复制)

  3. 打开新的故事板并按command-v粘贴完全相同的设置

  4. 转到项目设置,将主界面更改为新的Main_iPhoneV2(如果是你的iPad,你正在编写通用应用程序,你必须编辑-Info.plist并查找值主要故事板文件基本名称(iPad)

  5. 重新编译,然后停止拔头发

  1. Create a new Storyboard in your project, name it something like Main_iPhoneV2 (or iPadV2 depending on your original storyboard style)
  2. Open the broken storyboard, click anywhere in the white area and press command-a, then command-c (select all and copy)
  3. Open your new storyboard and press command-v to paste the same exact setup
  4. Go to your project settings, change your "Main Interface" to the new Main_iPhoneV2 (If it's your iPad and you're writing a universal app, you'll have to edit the -Info.plist and look for the value "Main storyboard file base name (iPad)
  5. Recompile, and stop pulling your hair out

这篇关于iOS 7 - 无法实例化默认视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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