问题描述
我正在尝试从OS X应用程序中的情节提要中实例化NSWindowController
:
I am trying to instantiate an NSWindowController
from a storyboard in my OS X app:
NSWindowController *mainWindowController = [[NSStoryboard storyboardWithName:@"Main" bundle:nil] instantiateControllerWithIdentifier:@"MainWindow"];
但这就是我得到的:
Storyboard (<NSStoryboard: 0x618000008500>) doesn't contain a controller with identifier 'MainWindow'
.
但在情节提要中:
已设置.不,没有其他情节提要.是的,我已经尝试清理项目和构建文件夹,但是没有任何变化.
It is set. No, there are no other storyboards. Yes, I've tried cleaning the project and the build folder, but nothing changes.
为什么会出现此错误?
更新:我正在构建我的应用,回到情节提要,但我看到情节提要ID尚未设置:
UPDATE: I am building my app, coming back to the storyboard, and I see that Storyboard ID is unset:
如何自动取消情节提要ID?
How can Storyboard ID get unset by itself?
推荐答案
这肯定是Xcode的错误.重新启动Xcode解决了该问题.
It was definitely a bug with Xcode. Restarting Xcode solved the problem.
这篇关于故事板不包含标识为"MainWindow"的控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!