Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c NSViewController initWithCoder-尚未加载捆绑包_Objective C_Xcode - Fatal编程技术网

Objective c NSViewController initWithCoder-尚未加载捆绑包

Objective c NSViewController initWithCoder-尚未加载捆绑包,objective-c,xcode,Objective C,Xcode,我的故事板中有一个viewController,我设置如下: 我使用以下代码以编程方式加载它 -(AttributeViewController*)AttributeVC{ if(!_AttributeVC) { _AttributeVC = (AttributeViewController*)[self.storyboard instantiateControllerWithIdentifier:@"MyAttribute"]; } return _Attribute

我的故事板中有一个viewController,我设置如下:

我使用以下代码以编程方式加载它

-(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;
}