user3774271 user3774271 - 1 month ago 60
iOS Question

App crashes on iOS10 with exception "There doesn't seem to be a valid compiled storyboard at path"

As of iOS10 I have users complaining that my app keeps on crashing at random and especially when the screen was locked. When they unlock the screen, they can see the app for a second and then it crashes. In the logs I can see many entries like these:


Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'There doesn't seem to be a
valid compiled storyboard at path
'/var/containers/Bundle/Application/serialcode/XXX.app/AppLaunchStoryboard.storyboardc''
*** First throw call stack: (0x1d465e07 0x1c6cb077 0x22c14083 0xe7d55 0x115ae7 0xbe37d 0x2252897f 0x22726e9d 0x1ed151e1 0x1dd46419
0x1dcc5743 0x1ec98f3f 0x1ed0f3d1 0x1ed1503d 0x227276fd 0x227273c1
0x22a2fa07 0x1ecfef2d 0x1ed2a9cb 0x1ed2a885 0x1ed2ab6f 0x1d421c8b
0x1d421795 0x1d41fa6b 0x1d36f073 0x1d36ee81 0x1eb17bfd 0x2250fccf
0x2250a401 0xbf879 0x1cb3a50b) libc++abi.dylib: terminating with
uncaught exception of type NSException


The "invalid" file is usually
AppLaunchStoryboard.storyboard
allthough I have also seen references to other storyboard files and .xib files.

Googling the above error points to incorrect build settings in XCode related to iOS architectures which I have double-checked. If my app wasn't being built for the right architectures, surely the app wouldn't even have been able to run in the first place?

This problem is NOT reliably reproducible, it can happen at any time.

Any suggestions will be much appreciated.

Answer

This issue was revolved by disabling caching in NSFetchedResultsControllers.

Some symptoms not mentioned before because I had no idea the symptoms were related:

  • I was never able to reproduce a crash in a Debug environment, only on a Beta or Release build.
  • The error message:

    [error] error: (NSFetchedResultsController): couldn't read cache file to update store info timestamps

    was frequently logged in the Debug output but never in Production logs.

  • After paying more attention to the above error message, I could see that my App was creating a large amount of File Descriptors, opening files in a cache folder and never closing or releasing them.

My App has quite a few NSFetchedResultsControllers created with:

NSFetchedResultsController *fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:context sectionNameKeyPath:nil cacheName:@"someName"];

which I changed to:

NSFetchedResultsController *fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:context sectionNameKeyPath:nil cacheName:nil];

which resolved the issue.

The following post also helped to point me in the right direction: too-many-open-files-after-calling-fabric-framework-run

Comments