Paolo Crociati
Paolo Crociati

Reputation: 495

Could not load NIB in bundle using storyboard

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.

Upvotes: 1

Views: 1540

Answers (3)

jvarela
jvarela

Reputation: 3847

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.

Upvotes: 0

Paolo Crociati
Paolo Crociati

Reputation: 495

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.

Upvotes: 2

user0321
user0321

Reputation: 23

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.

Upvotes: 2

Related Questions