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

具体异常信息:

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连接了。

原文地址:https://www.cnblogs.com/tuncaysanli/p/2727988.html