【问题标题】:iOS 8 iPads: Could not load NIB in bundleiOS 8 iPad:无法在捆绑包中加载 NIB
【发布时间】:2016-04-22 09:22:40
【问题描述】:

我的应用程序崩溃了,但我似乎无法找到问题所在。

启动后,我调用performSegueWithIdentifier 将用户移动到正确的ViewController。 这有效,但运行 iOS 8 的 iPad 除外(具体而言,到目前为止,它似乎发生在 8.3、8.4 和 8.4.1 上)。较新的 iPad 和 iPhone 没问题。

该应用程序有一个 SplitViewController(它是在调用前面提到的 performSegueWithIdentifier 时创建的),所以这可能与问题有关,因为它在 iPad 上的显示方式与在 iPhone 上的不同。

确切的错误是:

*** 由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“无法加载 NIB 捆绑:'NSBundle (已加载)',名称为 'I9T-iy-59z-view-exp-vQ-8nn'

【问题讨论】:

  • 是否有您在视图控制器中声明的名为 I9T-iy-59z-view-exp-vQ-8nn 的视图控制器
  • 我不知道如何搜索?
  • 我认为您的视图控制器名称不匹配,请检查一次
  • 看起来你在方法参数中给出了错误的包。
  • 那为什么这只发生在 iOS8 上呢?不是 9 号吗?

标签: ios xcode ios8


【解决方案1】:

这可能被视为 iOS 错误。我找不到任何 Open Radar 或错误报告,但请查看以下问题:

1 Terminating app: Could not load NIB in bundle: 'NSBundle ...' with name '7bK-jq-Zjz-view-r7i-6Z-zg0'

2 Could not load NIB in bundle: 'NSBundle when using storyboarding

所以我建议在UITabBarController 和每个UITableViewController 子视图之间插入一个UINavigationController。作为这个答案:https://stackoverflow.com/a/31196701/821053

或者,您可以摆脱 MasterDetail 的情节提要转场,并以编程方式添加它们:

let master = self.storyboard?.instantiateViewControllerWithIdentifier("SplitMasterController")
let detail = self.storyboard?.instantiateViewControllerWithIdentifier("SplitDetailController")
self.viewControllers = [master!, detail!]

【讨论】:

  • 是的!就是这个!我最终使用了解决方法,因为它是侵入性最小的,具体来说,我从情节提要中删除了主要和细节部分,并将它们添加到 viewDidLoad 中。我会更新你的答案以表明我的意思:)。
猜你喜欢
  • 2011-11-07
  • 1970-01-01
  • 2017-11-01
  • 2016-11-21
  • 1970-01-01
  • 2014-08-24
相关资源
最近更新 更多