Cameron Spickert
Cameron Spickert

Reputation: 5200

Xcode 6.3: Could not load NIB in bundle

When compiled using Xcode 6.3 (iOS 8.3 SDK), some nib filenames end up with an extra ~ipad or ~iphone in certain circumstances. For example, ViewController~ipad.xib becomes ViewController~ipad~ipad.nib. This is causing a crash because the app doesn't expect the compiled nib files to have the double suffix.

Upvotes: 20

Views: 13531

Answers (3)

Cameron Spickert
Cameron Spickert

Reputation: 5200

To fix this, uncheck “Use Size Classes” in any affected documents in Interface Builder.

This appears to be a bug in the version of ibtool included with Xcode 6.3 (and the iOS 8.3 SDK). It's happening in the following circumstances:

  • You have a device-specific input file *~(iphone|ipad).xib with size classes enabled.
  • Your deployment target is anything older than iOS 8.0.

I was able to reproduce the problem on the command line:

xcrun --sdk iphonesimulator8.3 ibtool --minimum-deployment-target 7.0 --compile ViewController~ipad.nib ViewController~ipad.xib

If you're seeing the same behavior, please duplicate this radar. This appears to be fixed in the latest Xcode 6.4 beta.

Upvotes: 39

Praveen Matanam
Praveen Matanam

Reputation: 2803

change ~ to _ in the xib name and specify explicitly the suffix while loading the bundle programmatically.

Upvotes: 2

joobik.com
joobik.com

Reputation: 96

This appears to be a bug of Xcode 6.3 when compiling XIB files. In order to workaround the exceptions there are 4 Options:

  1. Target your project to iOS 8
  2. Use storyboards instead of XIB files
  3. Disable Size Classes
  4. Handle NIB loading in code

I detailed each of these options in my blog post: http://www.joobik.com/2015/04/fixing-xcode-63-ios-sdk-error-could-not.html

Upvotes: 0

Related Questions