【问题标题】:XCode - Could not load NIB file bundleXCode - 无法加载 NIB 文件包
【发布时间】:2018-02-26 10:59:28
【问题描述】:

我在使用 XCode 时遇到了一些问题。我正在尝试从 nib 文件中加载单元格,但这很奇怪。如果我清理我的项目,有时一个视图会起作用,然后另一个视图将无法加载,如果我重新清理,它们有时会交换。

Xcode 中是否有一些缓存文件夹或我可以删除的临时文件? SO 上的常见解决方案似乎都不适合我。

2018-02-26 10:51:04.700364+0000 SpiceCentral[73982:3269187] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/james/Library/Developer/CoreSimulator/Devices/2190BB99-8811-437E-B620-3B4F917B391F/data/Containers/Bundle/Application/F83C4BDA-F236-4C22-B95F-6539FB8A8595/SpiceCentral.app> (loaded)' with name 'descTableViewCell''*** First throw call stack:

它试图加载的单元格:

override func viewDidLoad() {
    super.viewDidLoad(
    tableView.register(UINib(nibName: "descTableViewCell", bundle: nil), forCellReuseIdentifier: "descTableViewCell")
}


override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let descCell = tableView.dequeueReusableCell(withIdentifier: "descTableViewCell", for: indexPath) as! descTableViewCell
    return descCell
}

我的 descCell 笔尖文件:

我已经尝试清理我的项目,重新构建。关闭 Xcode,重新启动我的 mac,使用新的模拟器。

谢谢, J

【问题讨论】:

    标签: xcode xib


    【解决方案1】:

    通过重命名 nib 文件和对它的所有引用,我已经设法修复它(或者看起来如此)。我认为这不是一个好的解决方案,并且有一种适当的方法可以解决我的问题。我已经保存了该项目的旧版本,并将保留这个问题。我将尝试修复旧版本并标记正确答案。

    【讨论】:

      猜你喜欢
      • 2015-06-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-21
      • 2012-06-03
      • 2011-07-03
      • 1970-01-01
      相关资源
      最近更新 更多