Objective c NSViewController initWithCoder-尚未加载捆绑包
我的故事板中有一个viewController,我设置如下: 我使用以下代码以编程方式加载它Objective c NSViewController initWithCoder-尚未加载捆绑包,objective-c,xcode,Objective C,Xcode,我的故事板中有一个viewController,我设置如下: 我使用以下代码以编程方式加载它 -(AttributeViewController*)AttributeVC{ if(!_AttributeVC) { _AttributeVC = (AttributeViewController*)[self.storyboard instantiateControllerWithIdentifier:@"MyAttribute"]; } return _Attribute
-(AttributeViewController*)AttributeVC{
if(!_AttributeVC)
{
_AttributeVC = (AttributeViewController*)[self.storyboard
instantiateControllerWithIdentifier:@"MyAttribute"];
}
return _AttributeVC;
}
我的应用程序因以下原因崩溃:
-[NSViewController initWithCoder:] could not instantiate an NSViewController for a
nib in the "Attribute" bundle because the bundle has not been loaded.
为什么视图控制器现在试图加载我没有的属性包
谢谢。请尝试将带有名称引用的故事板也包含在其中。。。这对我有用
-(AttributeViewController*)AttributeVC{
if(!_AttributeVC)
{
_AttributeVC *attributeVC = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil] instantiateViewControllerWithIdentifier:@"MyAttribute"];
}
return _AttributeVC;
}