2

Since I have upgraded my project to xcode8 and swift3 I am having troubles when running my app on ios10 devices and simulators.

I can start the app normally but after a while using it I get the following error:

*** Terminating app due to uncaught exception   
'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle:
'NSBundle </Users/****/Library/Developer/CoreSimulator/Devices/****/data/Containers/Bundle/Application/****/*****.app> (loaded)' 
with name 'Ncx-Ud-4zl-view-1i6-0r-ivc' and directory 'Main.storyboardc''
***

The strange thing is that I can navigate through the same menu or view sometimes and after 3 or 4 times it gives me the error.

The app works properly on ios9 devices.

Update: I finally solved it updating my CoreDataStackManager class to the Swift3 sintax and also avoiding using caches on my NSFetchedResultsControllers.

  • did you check if you have that nib? – Lu_ Sep 26 '16 at 10:44
  • 2
    Yes @Lu_, the strange thing is that I can navigate through the same menu or view sometimes and after 3 or 4 times it gives me the error. – Adrian Martinez Sep 26 '16 at 10:55
  • write your navigation code. – ikbal Sep 26 '16 at 11:00
  • @Rock I don't think that be the cause of the problem. As I have said, the App loads as expected, and runs as expected for a couple minutes, but afterwards, the app will crash. – Adrian Martinez Sep 26 '16 at 11:39
  • It may be because the object is getting deallocated at some point. Check if there is weak reference to any object that is causing the object to deallocate. – PGDev Sep 26 '16 at 12:22
  • 1
    Can you please file a radar at http://bugreport.apple.com and include your app or a sample project that reproduces the issue? Please report back the ticket number here, so I can jump on it. Thanks. – Jeremy Huddleston Sequoia Sep 27 '16 at 05:28
  • encountering same problem – Neil Galiaskarov Oct 01 '16 at 10:34
  • @PGDev if this is the same error that I'm getting, the object isn't even getting a chance to get allocated, let alone deallocated. Because the crash occurs in the initializer, before anything is allocated. For some reason, it's a bundle resource problem. – PostCodeism Nov 03 '16 at 17:18
  • 1
    I am getting this same problem in a production release of my app - the app hasn't even been rebuilt for iOS 10, so it's impossible that it's an Xcode problem, FYI @JeremyHuddlestonSequoia. Once I ran it in Xcode 8 for the first time, I saw that I was getting this error as well. Along with Adrian, it's happening the 2nd or 3rd time that the nib is loaded (not necessarily though, there is no pattern). Sometimes it happens every time though. I have seen some strange iOS problems over 6 years, but this is one of the strangest. I've filed a bug report with the ticket number: 29092931 – PostCodeism Nov 03 '16 at 18:01

1 Answers1

2

I've also been struggling with this exact same issue all week where the NIB would sometimes not load randomly. I stumbled across something interesting today that solved my issue though:

(NSFetchedResultsController): couldn't read cache file to update store info timestamps (Thanks Donnit for the answer!)

In short, the problem was to do with the NSFetchResultsController which I use to retrieve and display CoreData models. If you are you using an NSFetchRequestController in your app and you have set your own cacheName inside the initialisation function, it seems a bug introduced by Apple in iOS 10 would open files in the background of the device every time the managed object context was saved. The max number of files an iOS device can open is 255 and so it can't open and load the new NIB files, and then crashes (which seems to be what we're getting).

Donnit has done some testing which shows that this is resolved in beta for iOS 10.2, but a temporary fix for this in the meantime until the update is publicly launched is to remove the cacheName from your NSFetchResultsController's.

Not sure if you have the same issue but it fixed everything for me.

Community
  • 1
  • 1
  • Might have nothing to do with the OP's issue, but then again it might. Anyway, interesting reading! – matt Nov 07 '16 at 03:08