现在的位置: 首页 > 综合 > 正文

【iOS】iOS/Xcode异常:reason:loaded the “SimpleTableViewController” nib but the view outlet was not set

2019年05月29日 ⁄ 综合 ⁄ 共 993字 ⁄ 字号 评论关闭

具体异常信息:

SimpleTable3[29418:11303] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘-[UIViewController _loadViewFromNibNamed:bundle:]
loaded the “SimpleTableViewController” nib but the view outlet was not set.’

libc++abi.dylib: terminate called throwing an exception

分析原因:

view的outlet输出口没有设置,也就是view视图没有和ViewController 视图控制器(或File’s Owner)建立连接。

如下图所示,这个连接关系在创建项目过程或者nib文件时,是默认建立这个连接关系的,只是有可能在开发过程中,不小心误操作,删除了这个连接关系。

如果上述view视图到视图控制器(File’s Owner)的输出口连接不存在了,可以按照下图重新建立到输出口outlet的连接,如图所示。

选择视图,在右侧的Connections Inspector 面板窗口,拖拉New Referencing Outlet右侧的图标到File’s Owner图标上,在弹出的上下文菜单中,选择view,就可以创建view视图对象到视图控制器的输出口outlet连接了。

其他参考链接:

iOS/Xcode异常:reason:
-[NSDecimalNumber isEqualToString:]: unrecognized selector sent to instance

iOS/Xcode异常:unrecognized
selector sent to instance 0x7fae23417410

iOS/Xcode异常:reason:
‘Could not instantiate class named NSLayoutConstraint’

iOS/Xcode异常:reason
= “The model used to open the store is incompatible with the one used to create the store”

iOS/Xcode异常:对象数组NSMutableArray添加元素-addObject,但count方法仍然返回0?

抱歉!评论已关闭.