Could not load NIB in bundle: 'NSBundle when using storyboarding

蓝咒 提交于 2019-11-27 06:38:47

问题


I am getting the following error when I use my app for a little while. Usually takes between 50 and 100 movements to cause the crash. I am not making sense of it though as I am using storyboards, and it is a NIB error.

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 
'Could not load NIB in bundle: 'NSBundle 
</Users/me/Library/Application Support/iPhone Simulator/5.0/Applications/GUID/appname.app>
(loaded)' with name 'MainStoryboard_iPhone.storyboardc/q8p-MH-tsT-view-acD-hJ-g0C''

I am not 100% sure where to begin looking, but I assume that this means that the storyboard is corrupt?

I looked through all of my source, and I don't have the string "nib" anywhere, so there are no nibWithNibName calls or the like. I also don't have a MainWindow.xib, though I tried creating one. I am not sure if it can be set to the main interface when I am using storyboards though. There is one reference to a .nib in the .xcodeproj/project.pbxproj file, however:

/* Begin PBXBuildRule section */
148BDD4C14AE8D5E002C30ED /* PBXBuildRule */ = {
    isa = PBXBuildRule;
    compilerSpec = com.apple.compilers.proxy.script;
    fileType = wrapper.nib;
    isEditable = 1;
    outputFiles = (
    );
    script = "$(DEVELOPER_BIN_DIR)/ibtool\n";
};

I am using storyboarding in Xcode 4.2. My main storyboard is set to MainStoryboard_iPhone, and its file is named MainStoryboard_iPhone.storyboard.

The crash is in the iOS 5 simulator.


回答1:


I got exactly this error, too.

Finally I found the cause was I accessed self.tableView in -(id)initWithCoder:(NSCoder *)aDecoder before it was initiated.

So, I moved those code into - (void)viewDidLoad, everything went well.




回答2:


This question appears to have been answered in the comments area. Reposting here so question shows as having an answer. -- gs.

Answer copied from comments:

There was a memory leak in a 3rd party component. Once the resources were exhausted, it would crash with the error above. A couple weeks of QA/Beta testing confirmed that it is gone. Thanks. – stubble jumper Jan 24 at 2:29




回答3:


I've had this problem before. The name of my nib was different than the name of my view controller while using - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil as my init.



来源:https://stackoverflow.com/questions/8689235/could-not-load-nib-in-bundle-nsbundle-when-using-storyboarding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!