ios - 由于未捕获的异常 'NSInternalInconsistencyException' 而终止应用程序,原因 : 'Could not load NIB in bundle

标签 ios objective-c

尝试在我的设备上运行我的应用程序时出现以下 SIGART 错误:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'ViewController''

我的 iOS 经验和知识非常有限,但我认为这可能与我的 ViewController.m 中的以下代码片段有关

-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    if((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))
    {
        log = [[NSMutableString alloc] init];
    }

    return self;
}

有人知道为什么会这样吗?

最佳答案

为了解决这个问题,我做了以下事情:

  1. 打开 XCode 目标
  2. 转到“构建阶段”选项卡
  3. 点击“复制捆绑资源”部分
  4. 点击添加按钮
  5. 添加丢失的 Nib 文件

或者这个问题也是关于 Nib 名称的。检查 nib 名称拼写,正确,区分大小写。

关于ios - 由于未捕获的异常 'NSInternalInconsistencyException' 而终止应用程序,原因 : 'Could not load NIB in bundle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19025487/

相关文章:

ios - objective-c :检查int是否存在,包括零

ios - 在点击不可选择的单元格后,先前选择的 UICollectionViewCells 被取消选择

ios - 如何向选定的 iPhone 用户发送推送通知?

iphone - 我可以在 iPad 的单个页面中有两个 UITableView 对象吗?

objective-c - native iOS Facebook SSO 不会返回到应用程序

objective-c - 黎曼和估计

iphone - UITableView样式中的自定义selectedSelectedBackgroundView出站分组

iphone - 将来自服务器的图像显示到 UIImageView

ios - iPhone Objective C 蓝牙免提音频增加 8000 采样率

ios - Sprite Kit,抑制速度较慢的iPhone的质量