以编程方式调用storyboard视图控制器时的Xcode断言

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了以编程方式调用storyboard视图控制器时的Xcode断言相关的知识,希望对你有一定的参考价值。

我以编程方式连接两个故事板视图控制器。我得到以下断言,

***断言失败 - [FullGalleryViewController loadView],/ SourceCache / UIKit_Sim / UIKit-2380.17 / UICollectionViewController.m:104

我的代码如下:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
FullScreenViewController *myVC = (FullScreenViewController *)[storyboard instantiateViewControllerWithIdentifier:@"FullScreenViewControllerId"];
[self presentViewController:myVC animated:YES completion:nil];

我已将故事板ID设置为FullScreenViewControllerId。我无法理解我哪里出错了。因为它紧迫而重要。

答案

您实例化FullScreenViewController并且断言失败在FullGalleryViewController中。这不是同一个班级。

以上是关于以编程方式调用storyboard视图控制器时的Xcode断言的主要内容,如果未能解决你的问题,请参考以下文章