Storyboard doesn't contain a controller with identifier 'MainWindow'

最后都变了- 提交于 2019-12-07 02:32:30

问题


I am trying to instantiate an NSWindowController from a storyboard in my OS X app:

NSWindowController *mainWindowController = [[NSStoryboard storyboardWithName:@"Main" bundle:nil] instantiateControllerWithIdentifier:@"MainWindow"];

But this is what I'm getting:

Storyboard (<NSStoryboard: 0x618000008500>) doesn't contain a controller with identifier 'MainWindow'.

But in the storyboard:

It is set. No, there are no other storyboards. Yes, I've tried cleaning the project and the build folder, but nothing changes.

Why would I get this error?

UPDATE: I am building my app, coming back to the storyboard, and I see that Storyboard ID is unset:

How can Storyboard ID get unset by itself?


回答1:


It was definitely a bug with Xcode. Restarting Xcode solved the problem.



来源:https://stackoverflow.com/questions/35379298/storyboard-doesnt-contain-a-controller-with-identifier-mainwindow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!