STORYBOARD EXCEPTION - Storyboard不包含带标识符的视图控制器

ori*_*gds 19 xcode storyboard ios

我目前正在为iPhone和iPad开发iOS应用程序.我正在尝试显示一个NavigationController来创建一个显示文件的模块.在iPhone中它工作得很好,但我不能让它在iPad上工作.

我收到以下错误:

'Storyboard (<UIStoryboard: 0x919b200>) doesn't contain a view controller with identifier 'FilesNavigation''
Run Code Online (Sandbox Code Playgroud)

这是代码:

case 10: // Files
{
  UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"FilesNavigation"];

  FilesViewController *filesViewController = [storyboard instantiateViewControllerWithIdentifier:@"Files"];

  [navigationController pushViewController:filesViewController animated:YES];

  self.slidingViewController.topViewController = navigationController;

  break;
}
Run Code Online (Sandbox Code Playgroud)

在我的故事板中,我已经为导航控制器设置了Storyboard ID.

>##Custom Class 
>Class: UINavigationController
>##Identity
>Storyboard ID: FilesNavigation
Run Code Online (Sandbox Code Playgroud)

我将此代码用于其他模块的开关/外壳块上的另一个案例,它也适用于iPad,这是我第一次遇到此错误.

ori*_*gds 55

我想通了,问题是故事板没有在设备中更新.

  1. 从模拟器/ iPhone/iPad卸载应用程序
  2. 产品>清洁
  3. 建立和运行

正如@ T0m_Twt在这个问题中的答案所述

  • 超级烦人,我永远不会认为这是解决方案. (3认同)

med*_*eda 11

在右窗格中,在身份检查器部分中,向导航控制器提供故事板ID.

我为你拍了一张截图

在此输入图像描述


Nix*_*ang 9

这是另一个案例:

有两个本地化的故事板.只有其中一个具有您想要的视图控制器.

  • 经过一段时间的浪费我的时间(Xcode的正常日子),这就是解决方案!谢谢! (2认同)