how to solve run time error of loaded the "DetailViewController" nib but the view outlet was not set.' - objective-c

I am beginner of iPhone here come the error of run time of
Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: '-[UIViewController
_loadViewFromNibNamed:bundle:] loaded the "DetailViewController" nib but the view outlet was not set.'
give any suggestion and source code which is apply in my code....

it would be easier to help you if you could post the code of your uiviewcontroller. I guess you have some IBOutlets which aren't connected properly between your UIViewController class and the corresponding Controller on the Storyboard

You have to connect your root view of the nib file to the view property of the files owner (your DetailViewController).

Related

Loaded the ... nib but the view outlet was not set [duplicate]

This question already has answers here:
Loaded nib but the 'view' outlet was not set
(32 answers)
Closed 5 years ago.
I'm getting this error:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "BYZ-38-t0r-view-8bC-Xf-vdC" nib but the view outlet was not set.'
Here's my select outlets bar:
How can I solve this?
I've tried the solutions suggested on this question, but none have worked for me so far.
You may have changed the content of you view. And because of that the nib has lost its view element.
To fix this error open your nib and select the File’s Owner. In the right-hand sidebar, click on the last tab--the one that looks like a circle with an arrow in it. See what you have connected to your controls in the storyboard. Make sure the view has connected to the view on the left bar. You can find more answers close to your question here. You can post some images of your select outlets bar if the error still exists.

Missing proxy for identifier UIStoryboardPlaceholder [duplicate]

This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 7 years ago.
Hi I seem to have stumbled upon weird thing while developing a storyboard app.
My app is halted right after splash screen and in console I get error message:
Missing proxy for identifier UIStoryboardPlaceholder
Now, if I try to let the app continue running, I get new messages into console, which I believe are related to the fact, that there is something wrong with the first error message
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[<IntroViewController 0x6e35f40> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key sceneViewController.
What is strange I get this error only when working with iOs 5.1 Simulator. It works fine on iOs 6 simulator and also on devices with both iOs 6 and iOs 5.1
I tried to find answer, but google says it could not find any results for the word UIStoryboardPlaceholder, let alone the whole error message. I made sure, I don't have the word 'UIStoryboardPlaceholder' anywhere within my xcode project(not even inside nib files) and also there's nowhere mentioned 'sceneViewController'. Any idea what might be wrong?
EDIT: I tried to reset simulator and cleaning project, but to no avail
We had the same problem: a view controller in a storyboard file with its interface defined in a separate XIB file. (Using Xcode 6.3.1, iOS 8.3 and Swift 1.2.)
We are using Swift so we had added the #objc() declaration to the class declaration:
#objc(TestViewController) class TestViewController: UIViewController
We could instantiate the view controller just fine from another view controller using self.storyboard?.instantiateViewControllerWithIdentifier( "TestViewController" ) but when presenting the view controller (using self.presentViewController( viewController, animated: true, completion: nil )) the app crashed with the same "missing proxy" and "not key value coding-compliant for the key sceneViewController" error.
Our solution which we found after much frustrated trial-and-error-like debugging was simply make sure the view controller's Storyboard ID in the storyboard file is not the same as the class name.
When we renamed the Storyboard ID from "TestViewController" to "testViewController" (only difference being the lower-case first letter), everything worked…
Strange? You betcha, but everything seems to be working now.
I had the same problem. Try cleaning the project and restoring the simulator.
I was getting the same error with an app that I was converting from .xib files to storyboards. My app contained a UITabBarController, and tapping on certain tabs would trigger the error.
In my case, the problem was that I had copied view controllers into the storyboard that used the "NIB name" property to load the view controller's view from an external .xib file. Storyboard view controllers do not support loading views from .xib files, so my storyboard contained a view controller that had no view.
I opened the external .xib file, copied the view, pasted it into the corresponding view controller in my storyboard, and made sure that the pasted view was subordinate (indented under) the view controller in the storyboard scene. Then I re-connected the view to the outlets in the view controller.
When I re-ran the application, the error was gone.
Add me to the list. I get this error after "refactoring - rename" on a class. The class I am renaming is a custom ViewController with its own .xib. I use Storyboard which launches a viewController containing a "Container View", which has my custom ViewController embedded in it upon launch.
The only way out of this so far is to NOT use my refactored .xib (disconnect it from the container view).
My semi-solution:
I have restored my app from a prior working snapshot and created a new custom ViewController and .xib from scratch instead of refactoring. Connected it to Storyboard and I got the error message again. Cleaned the build and deleted the app from the simulator and re-ran, and then it magically ran without error. For this reason I believe there is a bug in Xcode with Refactor-Rename, which corrupts some storyboard file behind-the-scenes. Once I confirmed that the new .xib was attaching to storyboard without error, I copied/pasted the class code into the new custom viewController class, and went through the process of reconnecting the class objects to the .xib, as you'd expect. Ran it and everything still worked.
FYI - here are some of the FAILED steps I took in my attempt to recover from the error (before giving up and restoring snapshot).
1. Cleaning Build.
2. Deleting App in iOS simulator.
3. Deleting all views in the custom ViewController .xib.
4. Naming the custom ViewController something else.
5. In Storyboard, adding a blank view to the ViewController representing my custom Viewcontroller class. This worked and allowed my app to run, however my custom class was neither able to load its own views in place of this default blank view, nor were it's own views visible upon making the default blank view transparent. Debugging showed my custom class .xib views being nil when assigned to self.view.
I am presently avoiding Xcode's Refactor-Rename for files having a .xib.
I had the same errors, finally solved it.
My problem was that I had :
[[storyboard instantiateViewControllerWithIdentifier:#"TripDetail"] methodThatDoesNotExist:#"param"]

Error in simulator when try run an app

I created app with using storyboards. My app has a table, some buttons and labels.
When I try to run my app simulator generates an error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x719de00'
UIViewController tableView:numberOfRowsInSection: means that I can't use "numberOfRowsInSection" with "UIViewController"?
I tried to use "UITableViewController" instead but with this controller I can't locate the buttons and labels in right place for me.
What I do wrong?
Thanks.
Once you Add the UITableView and set Datasource and Delegate, we must use some UITableview Delegate Methods. such as NumberOfRowsInSection, NumberOfSection, and so on.
Kindly Use the Essential Delegate Methods or Remove the UItableView.
You need to delegate the UITableView to the UIViewController, open the Connections inspector and drag the "delegate" and "dataSource" entries to the main view controller on the storyboard.

NSInternalInconsistencyException when loading nib file

Hello I have the following problem:
'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/BB022A34-E830-4B04-8A0A-71548502F1B6/MyInternallyIncosistentApp.app> (loaded)'
My application is localized in several languages. When the iPhone is set to English it works well, but when I set it to German it gives me the this error. I just push a view controller onto the navigation stack. The nib I'm trying to load is not localized. Any help is appreciated. Thanks.
This usually means you have broken some link between you nib file and you view controller, this can happen if you rename a IBOutlet or IBAction but don't update it in your nib.
My view controller xib was in the en.lproj folder for the english localization, so it only worked for English. I just had to move it out.

iPhone program immediately exits when loading a View from an NIB

The app in question is a simple sample program. In my view controller header, I have the button instantiated as such:
#interface ObscurelyNamedViewController : UIViewController {
UIButton *yoButton;
}
#property(nonatomic, retain) IBOutlet UIButton *yoButton;
- (IBAction)yoButtonPressed:(id)sender;
yoButtonPressed: is implemented as such:
[yoButton setTitle: #"I said 'yo', jammit!" forState: UIControlStateNormal];
// repeat for other button states
.
.
.
In Interface Builder, I have connected the Touch Up Inside event of the UIButton to the yoButtonPressed method in the File's Owner of the ObscurelyNamedViewController to recognize the touch. In return, I have connected the outlet of the File's Owner back to the yoButton, so as to enable the updating of it's title.
When I build and run, I get no errors, but nothing displays and the app immediately quits. The only other thing living in IB is a UIImage view. Am I missing something or have I wired something incorrectly?
EDIT: In the console, I see the following message:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "BradiiCaliiViewController" nib but the view outlet was not set.'
This likely has nothing to do with that action. You said, "nothing displays and the app immediately quits", which means that the action was never sent.
Need your message from the Console, but check
Did you use initWithNibName? If so, did you get the name exactly right?
Are you doing anything with Outlets in init? You should not -- and do it in viewDidLoad.
Knowing the message in your console will help us give you the real answer though.
Edit: based on your console message
Double-click .xib file to go to IB
Click on File's Owner
Go to Connections Inspector
The view outlet is not set (right?) -- drag the circle to the view icon in the Document Window.
(I am sorry, but I don't have IB in front of me -- this is from memory -- look around for the view outlet in connection inspectors if I am wrong about the exact location)
Moved from comment on Lou Franco answer:
BradiiCaliiViewController complains that it doesn't have a view even after NIB was loaded. You have to connect view outlet of File's Owner to your view in BradiiCaliiViewController's XIB.