Could not load NIB in bundle
Solution 1
Visit the properties of the .xib files in the file inspector,the property "Target Membership" pitch on the select box, then your xib file was linked with your target
Solution 2
In Targets -> Build Phases
Make sure the .xib is added to Copy Bundle Resources
, if it is not present then add .xib file.
Solution 3
try to find out all
XXXController = [[XXXControlloer alloc] initWithNibName:@"XXXController" bundle:nil];
in your code, and make sure that XXXController
are spelled correctly
Solution 4
I had the same problem (exception 'Could not load NIB in bundle: ..') after upgrading my xcode from 3.2 to 4.02. Whereas deploying of my app with Xcode 3.2 worked fine it crashes with xcode 4 raising the exception mentioned above - but only when I tried to deploy to the IOS Simulator (v.4.2). Targeting the IOS device (v.4.1) acted also with Xcode 4.
It turned out (after hours of desperately scrabbling around) that the reason was an almost "hidden" setting in the .xib-file:
Visit the properties of the .xib files in the file inspector: The property 'Location' was set to 'Relative to Group' for all .xib files. I changed it to 'Relative to project' and voila: all .xib files now are correctly loaded in IOS simulator !
I have no clue what's the reason behind that for this odd Xcode4 behavior but maybe it's worth to make an attempt ?
Solution 5
In my case it was very weird (use a storyboard): For some reason it changed from "Main storyboard file base name" to "Main nib file base name" in the plist.
Changing back to "Main storyboard file base name" (UIMainStoryboardFile) solved the issue
Goje87
Updated on July 13, 2021Comments
-
Goje87 almost 3 years
I am trying to integrate Janrain Engage as custom module with Appcelerator Titanium. I have created a sample module and dragged the JREngage folder to the sample module xcodeproj as indicated in the Jainrain's documentation.
Now I give build command to this project, then execute the
./build.py
and then finally I execute thetitanium run
command. It launches the application in simulator with a blank screen and immediately crashes throwing the following error.Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/abhilash/Library/Application Support/iPhone Simulator/4.2/Applications/CA167346-4091-4E16-B841-955D1D391713/test.app> (loaded)' with name 'JRProvidersController''
Why could this error be occurring?
-
Goje87 about 13 yearsHey Hanuman, I have checked that file JRProvidersController.xib exists. I have also tried to rename the file and execute, even then it's throwing the same exception.
-
Hanuman about 13 yearstry changing the invocation to initWithNibName:NSStringFromClass([MyViewController class]). Also check closely for file name as it is case sensitive
-
Hanuman about 13 years
-
Goje87 about 13 yearsI have made the changes suggested by you, but have got no success.
-
Robert Childan about 12 yearsAdditionally, if you are using alloc init, instead of initWithNibName:bunle:, what you will get is a black screen.
-
Nir Pengas about 12 yearssame thing here as michael is describing. i had created a xib file holding a custom UITableViewCell. when i open the .app and searched for myCell.xib, i see it's actually myCell.nib. further more, the app was only crashing on the device and load the xib file okay when executing on the simulator. it was a bit tricky to reset it. for me at least. only when i deleted the file, cleaned the target and copied the file back - did it work.
-
Ben over 11 yearsWondering why an absolutely unused .xib file must hang in a project file folder…
-
Yunus Nedim Mehel over 11 yearsI guess I accidentally unchecked this checkbox instead of autolayout. Fixed the crash for me, thanks
-
Pieter Jongsma almost 11 yearsThe reason you mustn't add the extension is that in your compiled bundle, .xib files are also compiled into .nib files. So there actually wasn't a MyFile.xib in your bundle, nevermind the double extension.
-
chings228 over 10 yearsit's easy , since the nibname is not autotyped
-
Rameez Hussain about 10 yearsGood one. Had the same problem. Thanks. This solved it.
-
BeccaP over 9 yearsThis solved my problem! Thank you. I had just duplicated my project and renamed all the pertinent files. Everything worked but this. Now everything works!!
-
Peter Kazazes over 9 yearsThis solved a crash I was dealing with when compiling a very out of date Quartz Composer plugin.
-
fotisgpap over 9 yearsmarked up as it also shows an easy way to find and view the package contents
-
i89 over 8 yearsThis solved my problem, since I got two storyboards "MyStoryboard.storyboard" and "MyStoryboard~ipad.storyboad"...so from the iPad target I removed "MyStoryboard.storyboard" from the "Copy Bundle Resources"
-
Gil Sand almost 8 yearsHe meant the class name in just before the alloc, which is autotyped :P
-
Stas almost 8 yearsall target membership checkboxes are grayed out for me...what could be the reason?
-
Kyle Goslan almost 8 yearsI just deleted Derived Data folder and it worked. Seems to get confused because I had renamed the xib file in the project navigation. Odd one.
-
Vyachaslav Gerchicov about 7 yearsuiview could be loaded from nib but doesn't have
initWithNibName:bundle:
method -
chings228 about 7 yearswe are talking about viewcontroller
-
Zaporozhchenko Oleksandr over 5 years@chings228 XXXControlloer and XXXController, see the difference
-
heximal about 5 yearsdoh. how could I get myself to this again. thanks kind man:) i was at very beginning of the researching this problem
-
SafeFastExpressive about 4 yearsFile name for my nib was FormItemCheckBoxCell.nib, class was FormItemCheckboxCell. Capitalizing "Box" in the name cost 45 minutes of my life.
-
Firda Sahidi almost 4 yearsFinally! I work in modular project of iOS and this is what I'm looking for. Thank you!
-
famfamfam almost 4 yearswhat is aViewInMyCustomView?
-
norbDEV over 3 years@famfamfam: a UIView
-
famfamfam over 3 yearstks, now i know how to use
-
jpb over 3 yearsSimilarly, I got an error like this when I (foolishly) tried to assign a table view delegate and data source in the init() rather than viewDidLoad()
-
Pravalika over 3 yearsI had an extra character in my .xib file name. If I didn't come across your answer, I might have never figured it out. Thanks a lot.
-
LMaker over 2 yearscan you show how you did?