This problem occurs when the initwithnibname function is used and the view attribute of viewcontroller generated by the NIB file is used.
// Load LOC. XIB
Uiviewcontroller * uivc = [[uiviewcontroller alloc] initwithnibname: @ "Loc" Bundle: Nil];
[Self. View addsubview: uivc. View];
[Uivc release];
Nibname [220:207] *** terminating app due to uncaught exception 'nsinternalinconsistencyexception', reason: '-[uiviewcontroller _ loadviewfromnibnamed: Bundle:] loaded the "Loc" nib but the view outlet was not set.'
It indicates the NIB file we loaded. The "View" attribute value is not set.
The actual situation here: not the generated VC's view property value is nil, but the generated VC does not have the view property. We use the VC defined by uiviewcontroller. Why does VC (View Controller) have no view attribute?
(What a logical expression is not as good as a successful complete operation, begin :)
Solution:
1. Click the XIB file we want to load.
2. Select File's owner on the right.
3. In the "Custom class" attribute settings on the tab of the file's owner, change the class value to the corresponding VC, and change it to uiviewcontroller,
4. In this case, the view attribute "pending connection settings" will appear on the file's owner tab, which is what our compiler tells usThe view outlet was not set. When the class of the file's owner is nsobject, there is no view attribute.
Connection view property,
5. Win + R, OK.