Could not load NIB in bundle using storyboard

邮差的信 提交于 2019-12-24 14:54:13

问题


With the last version of iOs 8.3, I get this error when I run one of my app:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle

The app has 2 storyboards, one for iPhone (working normally) and the other for iPad (crashing).

I've tried the suggestions of this topic with no results: Xcode 6.3: Could not load NIB in bundle

In my case I'm using StoryBoards and I've no flag on "Use size classes". Until iOs 8.2 the app worked fine.

Is this a iOs 8.3 bugs? Anyone founded a solution? Thank you!

EDIT: If I use the iPad storyboard on iPhone and the iPhone storyboard on iPad they work! I also tried to rename the storyboards, but nothing change.

EDIT 2: The SplitViewController as initial view controller causes the crash! If I move the initial view controller to another view controller the app works!

EDIT 3: Some news: the problem is caused by the MasterViewController of my SplitViewController. I'm using a TabBarController as MasterViewController and it crash with iOs 8.3. If I change the MasterViewController to another view, the app works.


回答1:


If you have done it programmatically then change ~ to _ in the xib name and specify explicitly the suffix while loading the bundle programmatically.Hope it may help you.




回答2:


The problem was caused by a SplitViewController with a TabBarController as a MasterViewController. This cause a crash in iOs 8.3. I replaced the TabBarController with buttons and now the app is working.

I hope this informations may help someone.




回答3:


I was returning nil in the required init? method

required init?(coder decoder: NSCoder) {
    return nil
}

because I thought only the method init(frame:) was going to be called. Moving the initialization code to viewDidMoveToWindow and removing both init methods solved the problem.



来源:https://stackoverflow.com/questions/29805703/could-not-load-nib-in-bundle-using-storyboard

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