Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
802 views
in Technique[技术] by (71.8m points)

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

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
";
};

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...