我使用“master-detail”模板启动了我的应用程序。我只是添加了另外两个 VC,并将“初始 View Controller ”复选框更改为“安全文化 MainVC”...当我运行时,我的应用程序崩溃了...
我需要做什么?!
这是默认 Storyboard的屏幕截图,其中包含我的另外两个 VC——它们在“导航 Controller ”为默认值时工作。
很明显,我是初学者,所以您提供的尽可能详细的信息对我很有帮助!! 谢谢!
调试输出:
2012-06-07 10:38:42.812 SafetyCulture[1020:fb03] -[safetyCultureMainVC topViewController]: unrecognized selector sent to instance 0x6b7c210 2012-06-07 10:38:42.840 SafetyCulture[1020:fb03] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[safetyCultureMainVC topViewController]: unrecognized selector sent to instance 0x6b7c210' * First throw call stack: (0x16ae022 0x183fcd6 0x16afcbd 0x1614ed0 0x1614cb2 0x2619 0x17386 0x18274 0x27183 0x27c38 0x1b634 0x1598ef5 0x1682195 0x15e6ff2 0x15e58da 0x15e4d84 0x15e4c9b 0x17c65 0x19626 0x22ed 0x2255) terminate called throwing an exception(lldb)
最佳答案
topViewController
是UINavigationController
的一个方法。您的应用程序尝试调用此方法,但由于它不存在,因此崩溃了。
在您的图像中,您的入口点箭头仍在导航 Controller 上:
通过拖放将其移动到您的 safetyCultureMainVC
,如下所示:
关于ios - Xcode: Storyboard更改初始 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10933780/