NSInternalInconsistencyException - Could not load NIB in bundle - iphone

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.

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 :) !

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?)

Could not load NIB in bundle

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.

Error on empty project: "this class is not key value coding-compliant for the viewcontroller."

this error drives me crazy. I already spent hours on fixing this, unfortunately without success.
I tested my app in simulator, everything works fine. I'am testing it on my device (iphone 4 with ios 4.3.3) the app won't start.
So I tried creating a new project, build and go. And the end of the error now says instead of viewcontroller, key window.
To get further information about the error I setup an exeption breakpoint whicht breaks on throw and on all exeptions. Something interesting happend now: when I am launching the empty project on my iphone I get a warning:
warning: Unable to read symbols for /Users/xxx/Library/Developer/Xcode/DerivedData/testing-cmaekkzgdqyseidlqkorvrdvvodg/Build/Products/Debug-iphoneos/OLDAPP.app/testing (file not found). (The app which I am runnning is called testapp, not OLDAPP?! This was my last project!)
Some further errors now occure:
Unknown class OLDAPPAppDelegate in Interface Builder file. and Unknown class RootViewController in Interface Builder file.
I did clean all targets and made a clean build. Nothing changes…
I didn't change anything in IB, just edited the provisioning profile to run the app on my phone.
Help is very appreciated here :-) Hopefully someone can help me I would be really thankful.
The whole error message: *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UICustomObject 0x18b410> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key window.'
This happens to me if I change the name of an outlet on the ViewController which was connected to something in the View in Interface Builder. For example, renaming 'labelFirstName' to 'lblFirstName' and forgetting to break and recreate the connection in IB.
I had the same problem where there were no !'s in my XIB and no re-naming problems. To fix it, I just created a new XIB, copied in the view from the old XIB, and rewired all the connections.

problem with localization in objective c

I have a German program written in objective C for iPhone.
I want localize it to English, so in a file.xib I clicked on + to add localization, English appears, then I insert German.
Running the app with iphone in English goes ok, if i change language it crashes.
I've tried clean-rebuild and check folders but i get this error
* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'MainWindow''
I don't know what the hell was happening, but I solved the problem by removing the original MainWindow.xib and adding a new one, which was not related to any localization.
Grrrr!