Cannot display a view controller if the bundle contains another xib file with the same name minus “Controller”.
Example: “LittleViewController.xib” and “LittleView.xib”
如果 App Bundle 中存在一个与 “LittleViewController” 名称相似、重名的 “LittleView.xib”, 则该 “LittleViewController” 将无法载入, 表现为崩溃.
2015-03-04 17:49:29.567 Radar Sample[22570:18122050] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘-[UIViewController _loadViewFromNibNamed:bundle:] loaded the “LittleView” nib but the view outlet was not set.’
- Create a new Cocoa Touch class which is a UIViewController subclass. (APPLViewController for example).
- Write code to display that view controller on your device.
- Run your application and observe that you can display the view controller.
- Stop your application.
- Create a new Cocoa Touch class which is a UIView subclass (APPLView for instance).
- Add a new Interface Builder object (type View) to your project with the same name as the previous UIView subclass (APPLView.xib in that case).
- Run your application and observe that you cannot longer display the view controller (crash).
Display the view controller.
正常显示 view controller.
Crash before the view controller is displayed.
在 view controller 显示之前发生了崩溃.
Rename your view/xib or view controller to avoid this problem.
重命名 view/xib 或 view controller 就可以避免该问题.