UIStoryboard无法找到带标识符的视图控制器

gab*_*ios 9 ios uistoryboard xcode-storyboard

我有一个ios应用程序使用故事板和一堆视图控制器.

添加新的ViewController后,配置了标识(Storyboard ID) 在此输入图像描述

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

SurveyNewViewController *newSurvey = [[self storyboard] instantiateViewControllerWithIdentifier:@"newSurveyView"];
[self presentViewController:newSurvey animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

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

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

这有什么可能的解释吗?我在系统的不同位置使用了相同的方法,效果很好.

小智 39

在运行项目后,尝试从iPhone模拟器中删除您的应用程序,清理项目并构建.