简体   繁体   English

故事板不包含标识符为“MainWindow”的控制器

[英]Storyboard doesn't contain a controller with identifier 'MainWindow'

I am trying to instantiate an NSWindowController from a storyboard in my OS X app:我正在尝试从我的 OS X 应用程序中的故事板实例化一个NSWindowController

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' . 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:更新:我正在构建我的应用程序,回到故事板,我看到故事板 ID 未设置:

在此处输入图片说明

How can Storyboard ID get unset by itself? Storyboard ID 如何自行取消设置?

It was definitely a bug with Xcode.这绝对是 Xcode 的一个错误。 Restarting Xcode solved the problem.重新启动Xcode解决了这个问题。

Confirmed in 11.3.在 11.3 中确认。 This is such a time-waster, together with this one:这太浪费时间了,再加上这个:

How do I open another window in macOS in Swift with Cocoa 如何在 macOS 中使用 Cocoa 在 Swift 中打开另一个窗口

暂无
暂无

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

相关问题 故事板不包含带有标识符的视图控制器 - Storyboard doesn't contain a view controller with identifier 错误情节提要不包含带有标识符的视图控制器 - error Storyboard doesn't contain a view controller with identifier 错误:Storyboard不包含标识符为&#39;jailBrokenViewController的视图控制器&#39;&#39; - Error:Storyboard doesn't contain a view controller with identifier 'jailBrokenViewController'' 使用多个storyboard文件时,Storyboard不包含带标识符的视图控制器 - Storyboard doesn't contain a view controller with identifier … when using multiple storyboard files 如何在XIB或不包含故事板的项目中使用地图? - How to use map in XIB or a project that doesn't contain storyboard? 当我使用“使用标识符执行segue”方法时,情节提要板不会推送视图 - Storyboard doesn't push a view when i use “perform segue with identifier ” Method 为什么一个故事板包含一个UITabBarController不能显示另一个故事板/ - Why a storyboard contain a UITabBarController can't present another storyboard/ 如何使用LGSideMenuController推送带有情节提要标识符的视图控制器? - How can I push view controller with storyboard identifier using LGSideMenuController? 如何在没有xib或情节提要vc标识符的情况下制作视图控制器? - How to make a view controller without a xib or a storyboard vc identifier? 如何在故事板中为视图控制器提供“标识符”? - How do I give an “identifier” to a view controller within my storyboard?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM