Sarah
Sarah

Reputation: 1595

iPhone app crashing with error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:

My app is crashing when heavy testing it with various error messages like:

 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:
ImageIO: CGImageRead_mapData 'open' failed error = 24 (Too many open files)

In this viewcontroller I'm testing I load multiple audio files and images as well. The app works fine on normal cases.Is there something I'm missing? Any help would be appreciated. Thanks,

Upvotes: 1

Views: 1466

Answers (2)

Nektarios
Nektarios

Reputation: 10371

Close your file handles, that is a limited system resource. As described in the programming guides from Apple, you should free these resources immediately when you are done with them, and should design software around limiting usage of these scarce system resources. Also note that you may not be the only one using those resources!

An issue you perhaps are hitting is - don't free these scarce resources in dealloc methods. Those aren't guaranteed to be called when you expect, or ever. Instead, explicitly release those resources.

Upvotes: 1

Caleb
Caleb

Reputation: 124997

Terminating app due to uncaught exception 'NSInternalInconsistencyException'

Something in your app is throwing an exception. You're not catching that exception, so it percolates down the stack and eventually hits the default exception handler, which terminates the app. You can probably fix the problem by catching that exception and dealing with it before it gets to the point of termination.

reason: 'Could not load NIB in bundle: ImageIO: CGImageRead_mapData 'open' failed error = 24 (Too many open files)

Considering what you say you're doing, it's probably no surprise that this would happen. So, in addition to improving your exception handling, you might want to limit the number of files that you have open at one time.

Upvotes: 1

Related Questions