1

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.

techspider
  • 3,370
  • 13
  • 37
  • 61
potlood
  • 41
  • 6
  • Try this solution: http://stackoverflow.com/a/26239971/1689376 – alexburtnik Oct 13 '16 at 14:06
  • None of my Storyboards have Localization turned on and I don't have an Extension. I'll try turning on Localization... – potlood Oct 13 '16 at 14:41
  • Localization did not work, problem still persists. – potlood Oct 14 '16 at 12:46
  • Have you changed device family recently? Is your app Universal or iPad/iPhone only? Is Size Classes feature enabled in your storyboard? Please answer all these questions. – alexburtnik Oct 15 '16 at 00:40
  • I have been fiddiling with the device family setting as per stackoverflow.com/questions/40036842/… which have now been solved. App is Universal. The Size Classes feature is enabled. All items have Compact Width x Regular Height and Regular Width x Regular Height installed. On some items the top most "Installed" (which I believe is Any by Any) tickbox is ticked and some unticked. – potlood Oct 17 '16 at 08:10
  • Correct link: [link](http://stackoverflow.com/questions/40036842/xcode-build-fails-when-switching-from-iphone-to-pad-or-vice-versa/40038998#40038998) – potlood Oct 17 '16 at 14:20

1 Answers1

0

This issue was resolved 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

potlood
  • 41
  • 6