UIStoryboard无法找到带标识符的视图控制器 [英] UIStoryboard Couldn't find view controller with identifier

查看:563
本文介绍了UIStoryboard无法找到带标识符的视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用带有一堆视图控制器的故事板的ios应用程序。

I have an ios application using storyboards with a bunch of view controllers.

添加新的ViewController后,配置了识别(故事板ID)

After Adding a new ViewController, and configured the identify (Storyboard ID)

我尝试实例化用下面的代码新的ViewController:

I try to instantiate the new ViewController with the following code:

SurveyNewViewController *newSurvey = [[self storyboard] instantiateViewControllerWithIdentifier:@"newSurveyView"];
[self presentViewController:newSurvey animated:YES completion:nil];

一切似乎都是正确的,但在模拟器上运行应用程序时崩溃:

Everything seems to be right, but when running the application on the simulator it crashes:

** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:   
'Storyboard (<UIStoryboard: 0xa340fa0>) doesn't contain a view controller 
with identifier 'newSurveyView''

是否有任何可能的解释这个?我在系统的不同位置使用了相同的方法,效果很好。

Is there any possible explanation for this? I have used this same approach in different places on the system and it works well.

推荐答案

尝试从iPhone模拟器中删除你的应用程序,运行项目后清理项目和构建。

Try remove your app from iPhone Simulator, clean project and build, after run your project.

这篇关于UIStoryboard无法找到带标识符的视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆