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''
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
Not sure if you have the same issue but it fixed everything for me.