1

My app works perfectly on the simulator, but as soon as I launch it on my physical device, I get this exception:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/containers/Bundle/Application/E1868188-8412-40F9-AD77-B4CA9DA47415/Aremiti.app> (loaded)' with name '0mX-RV-bpN-view-yyb-5A-n89''
*** First throw call stack:
(0x184b52fe0 0x1835b4538 0x184b52f28 0x18b18a600 0x18afeb2d4 0x18adb546c 0x18ad84c6c 0x18ac83b68 0x18ac83a9c 0x1000e5494 0x1000e34a4 0x1000e3524 0x18b18b8d8 0x18b2d9a50 0x18b2d9790 0x18b18b57c 0x18b18bd1c 0x18b2d9a50 0x18b2d9bc8 0x18b2d9790 0x18b18a8bc 0x18b444f54 0x18af08488 0x18acf4e94 0x18af070c4 0x18af1bd18 0x18af04474 0x1866fb884 0x1866fb6f0 0x1866fbaa0 0x184b0142c 0x184b00d9c 0x184afe9a8 0x184a2eda4 0x18acee384 0x18ace9058 0x1000f62b8 0x183a3d59c)
libc++abi.dylib: terminating with uncaught exception of type NSException

I am aware that this may be thrown when a file's name is changed outside of xcode. However, I haven't touched any of the file names.

Loïs Talagrand
  • 810
  • 2
  • 13
  • 32
  • Possible duplicate of [NSInternalInconsistencyException', reason: 'Could not load NIB in bundle](https://stackoverflow.com/questions/27842740/nsinternalinconsistencyexception-reason-could-not-load-nib-in-bundle) – Ssswift Jun 26 '17 at 23:22
  • If you archive the project and export an ipa does the exported bundle have it? Also, did you try build clean? What about renaming your xib? – Allison Jun 26 '17 at 23:22

2 Answers2

2
let customView = Bundle.main.loadNibNamed("SomeNib", owner: self, options: nil)?[0] as! myClass

probability you NIB name is wrong you...please check your nib name which you made ..you should include SomeNib.xib in loadNibNamed

you should also have to check whether your SomeNib.xib copy into Copy Bundle Resources in Build Phases section of project target ?

Foolish
  • 159
  • 10
0

I encountered similar error and the reason was that a subView to the current view (self.view.addSubView) was being added in the class's initializer method (when using a storyboard). Moving the code to viewDidLoad fixed it.

Vishal Chaudhry
  • 2,834
  • 1
  • 22
  • 8