Could not load NIB in bundle - iphone

I don't know why I'm getting this error:
** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle < /Users/username/Library/Application Support/iPhone Simulator/4.2/Applications/D49DC6F2-7AE0-4BBD-97FB-AB9D869C48FE/Fish Quiz.app> (loaded)' with name 'Taxo2ViewController'' *
I checked all of the similar posts regarding this error but still my app generate this error. I checked all of my nib files, checked their types and they are all similar.
My app is a quiz; I have 5 questions each round. This error occurs after answering 45+ rounds of questions. I wonder why this is happen even though my app works at first. Please help me with this.
Thanks Everyone! Cheers!
Kim

Make sure to write your code correctly. Take a look at it again and see if there are mistakes.

I seen your code you provided in the links above. I found problem in your goToNext function given in first link above. What you have done is, you are having one view controller having two xib files, that is your TaxO2ViewController has two xib files. So in each of these two xib files the owner should be your TaxO2ViewController and the view property of TaxO2ViewController should be bound to both of this xib files. Probably you do not have done that.

Related

NSInternalInconsistencyException uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: NSBundle with name

I'm having a strange error in my iOS app. Everything was working well since yesterday and today I made some improvements on a view controller that has nothing to do with the AppDelegate and when I tried to test the changes I've made on the simulator, I got this error :
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in
bundle: 'NSBundle
(loaded)' with name 'xxx'
I searched a lot in Google and this website to try to find a solution, and all the topics I found were talking about problems with xib files. However, I'm using Storyboards and my app is iOS6.1 only so I have no xib files ... I also checked that the storyboard was included in "Build Phases" and everything seems right :s. I know that this error could happen when some files were included in the Finder but not in Xcode, however that's not the case for me: I always included the files directly in Xcode and checked the "copy files to directory" option. I even tried to revert the changes I made, and I still have this issue so I really don't know what is going on. My app is really simple at this stage, I just have a couple of view controllers connected through a navigation controller and 1 external framework (AFNetworking). My AppDelegate (where the error seems to happen) is clean: I didn't add anything to the sample code that was provided by Xcode.
I'm really stuck with this issue and I hope you could find a way to help me solve it.
First, try using the Xcode/Product/Clean menu item. If that doesn't do it then go to the Organizer, switch to Projects, and delete the Derived folder for your project. If you do the second, quit Xcode and start again just to be sure all is wiped.
EDIT: if you want, zip the thing up, and send it to my email address in my profile. I can only spend a few minutes with it but will at least take a look.
EDIT2: learned a few things here, but no fix. What you are seeing is that the StoryBoard is trying to product the rootViewController, and fails - the app delegate never even gets messaged. The EventsTVC class gets sent initWithCoder:, and then later is asked for its nibName, which it returns. This nibName is an identifier into the storyboard - and is what internally Apple must be using to construct a nib. However, that fails. You can see the name by adding this to EventsTVC:
- (NSString *)nibName
{
NSLog(#"NIB NAME %#", [super nibName]);
}
What I did to reproduce the problem was create a new StoryBoard Master/Detail app, and add this to the rootviewcontroller:
- (NSString *)nibName
{
NSLog(#"NIB NAME %#", [super nibName]);
return [[super nibName] stringByAppendingString:#"foo"];
}
This of course makes the nibName bogus, and it causes the app to fail where yours does, with the same message.
You have two choices: you can burn a DTS incident on this - see if you can get Apple to fix it (might take a few days), or you can just redo the project, and copy as much of what you can back into the new App.
In any case it would be really great if you could send the same zip file to Apple and create a bug report on it. I suspect that the storyboard is corrupt internally, but there are no public methods to use to delve into it (look at UIStoryBoard).
Since ios7 and Xcode 5, it does this to me every morning ! I don't know what kind of mess they did in xcode but it's annoying. If you want to pass this bug, go to organizer, then delete the "derived data" (if somehow it doesn't want to delete, go delete it in terminal with a good old rm -rf), then run you app, it will crash again, this time go to you simulator and click on reset settings and everything. Now run your App again your done :) !

App throwing error "This class is not key value coding-compliant for the key view." after a long time working well

I'm getting this error on a project i've been working on for a while : "Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'" (it does with each of my outlets).
My app was working very well until I tried to bypass code-signing, and tried to do some Profiling with Instruments (I actually found out the error with Instruments).
(Additionnal info) I've built a subclass of UIViewController, with .h .m and .xib files, named EEMainViewController. I instantiate it in my EEAppDelegate to display it as a subview of my main window. In the .xib, I have 1 view, 3 UIPickers and 2 UITextField. As soon as only one of the outlets gets linked to the FO, the program exits and throws the error, and when none is linked, it says that the 'view' property has not been set (which is normal, since it's not connected).
I already checked all the IB and Bindings blahblah, and nothing seems to work in my case : all my outlets are connected properly (XCode is showing grey dots next to the #property in the .h file) and I'm instantiating the right classes in my code. It's pretty weird.
If you want a piece of code (only a piece, it's became really huge), feel free to ask me for some.
Thanks for reading !
I found a solution to my problem : I erased the EEMainViewController from my project (making sure all the outlets in my .xib were disconnected) and pasted the .h and .m content in a new class I created named EERootViewController, replacing all the occurrences of "EEMainViewController" by "EERootViewController" in my code. I rebuilt the .xib from scratch and connected as i was doing previously. Everything seems to work fine.
I don't know where the problem was coming from, unfortunately, so I guess we won't learn anything more about this case.
I still don't mark this thread as done, in case s.o finds the reason to the problem.
Sorry for bothering !

nib file removed but key value connection remains - NSUnknownKeyException [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.
I've been looking through the archives and haven't found a question that answers this. So I'm hoping this is something obvious I'm just missing.
I have an iphone app that's been in the store with various releases over the last 2 years. I finally got frustrated with managing orientation changes through nib files. So I've removed my nib completely from the project and I create all of my fields through code now.
I saw an odd crash in my testing after I'd removed the nib file. But I did some clean up work and couldn't reproduce it. So I've shipped the product. A small subset of my users have seen a crash situation.
I believe I was able to reproduce it in my debugger and got this output.
2012-10-22 08:08:22.776 ChakraChimePro[60502:16d03] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason:
'[<CCProChimeViewController 0x8578100> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key btnRingBowl.'
*** First throw call stack:
(0x1f57022 0x1ccacd6 0x1f56ee1 0x2b6022 0x227f6b 0x227edb 0x242d50 0x78871a 0x1f58dea 0x1ec27f1 0x78726e 0x62d1fc 0x62d779
0x62d99b 0x6490a9 0x648edd 0x6474aa 0x64729e 0x351b 0x564386 0x565274 0x574183 0x574c38 0x568634 0x20eaef5 0x1f2b195 0x1e8fff2
0x1e8e8da 0x1e8dd84 0x1e8dc9b 0x564c65 0x566626 0x2ef6 0x2e25)
terminate called throwing an exception(lldb)
so I've completely removed my class property btnRingBowl. There is no reference to it in the class any more. But I've also completely removed the nib file that was attached to the IBOutlet. So there shouldn't be any reference to it anymore.
Why is my binary still trying to access it?
I've tried deleting the app and reinstalling and the problem goes away.
I've installed the same version of the app that's up on the app store and the problem goes away. I can't reproduce the problem on demand. But I can reproduce it and it's causing crashing for my users.
Since I've completely removed the nib and the properties. I don't know what else I can clean up. Any suggestions?
A string search of my project reveals no reference to this name anywhere.
Thanks,
Kevin
Ran into the same exact problem. NIB/XIB files had been removed long ago (before my initial submit), and only with a recent update fix did this pop-up.
I ended up restoring the old nib files from git, and everything worked. Then removed the broken IB Outlets, rebuild project with those XIB files, and proceed onwards.
I'm not sure if restoring the old nib files will be an option for you, and if not, perhaps rebuilding another nib file of the same name, and force rebuild the project with the new nib file (so it clears the old references out?)

NSInternalInconsistencyException - Could not load NIB in bundle

I am getting following exception:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/57C8544B-05F6-445D-80A9-FAC9672F278B/MyApp.app> (loaded)' with name 'MyNibName''
I tried number of solutions suggested in stackoverflow's similar questions, but still getting this issue.
This issue is with particular xib file which loads address book.
This occurs only on iPhone and not on iPad and simulator.
I also tried deleting the existing xib file and creating a new one but didnt work out.
With few attempts of testing, I found that the file works fine for certain number of attempts and then starts giving above error only on iPhone.
Please help.
Thanks in advance.
Finally after long debugging and testing, I found the issue. The issue was NOT with NIB file, but it was with two nsmutablearrays that I had declared and was populating but not using them. I removed them and then it worked. This was bit strange for me.

"Could not load NIB in bundle" error on iPhone but not on Simulator

Up until yesterday I had a perfectly working app on my iPhone. I made a few tweaks yesterday and now the app works on my simulator but not on the iPhone. The error message I am getting is right after the "applicationDidFinishLaunching" finishes.
The error is:
'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle ....> (loaded)' with name 'RootViewController''"
The weird thing is, I don't have any xib files called RootViewController. I renamed mine a month ago to CategoryViewController and this has worked fine up until yesterday. I verified in each of my viewControllers that there is no reference to a "RootViewController".
I searched with "CTRL+shift+F" "RootViewController" and there is no file in my project that mentions this.
The tweaking I was doing had to do with the target info.plist and I only added the Application supports iTunes file sharing option. Here is my info.plist in case I messed something up:
I also had run "Clean" for the first time yesterday.
I verified that my MainWindow.xib file has all the connections it is supposed to have and compared this against the original sample project I used as a base.
I tried reverting the project back to an earlier snapshot when I am positive it worked and now that doesn't even work. It seems my iPhone bundle got corrupt. But it does the same thing even after I delete the app from my iPhone and try again.
How do I go about debugging this? I have spent 10 hours already trying to fix this and really need some help.
The Xcode templates create an Info.plist file that specifies the main nib file.
-The default nib name is "MainWindow".
-The default version of that nib file contains a Navigation controller that references a view named "RootViewController".
However, each of those can have variations for iPhone or iPad. Those files have ~iphone or ~ipad added to the end. They system will pick the variation automatically by suffix.
You could have gotten a different nib file for that reason which tried to load RootViewController.
Also, if you have a view or view controller inside your nib that references RootViewController, the OS will try to load it. (It instantiates almost everything in a nib file once it is opened.)
This was resolved by refactoring and renaming my first viewController back to RootViewController. The moral of the story is do not change the name of the RootViewController. There are built in references to it that are not easily changed. There is no real need to use a different name. Once I did this, everything worked again.