App crashes if a xib file has almost the same name as a view controller.

Originator:sebastien
Number:rdar://20049040 Date Originated:3/4/2015
Status:Open Resolved:
Product:iOS SDK Product Version:8.1
Classification: Reproducible:Always
 
Summary:
Cannot display a view controller if the bundle contains another xib file with the same name minus "Controller". 
Example: "LittleViewController.xib" and "LittleView.xib"

Crash logs:

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.'

Steps to Reproduce:
1- Create a new Cocoa Touch class which is a UIViewController subclass. (APPLViewController for example).
2- Write code to display that view controller on your device.
3- Run your application and observe that you can display the view controller.
4- Stop your application.
5- Create a new Cocoa Touch class which is a UIView subclass (APPLView for instance).
6- 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).
7- Run your application and observe that you cannot longer display the view controller (crash).


Expected Results:
Display the view controller.

Actual Results:
Crash before the view controller is displayed.

Crash is:

2015-03-04 17:49:29.567 Radar Sample[22570:18122050] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "WrongBehaviorView" nib but the view outlet was not set.'

Download sample project: http://cl.ly/3s2c1v1I1J1Q

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!