We have an application that has been using CoreData stores since 2009, but is suddenly having some strange behavior when the application is launched via the Finder.
The application has up to a couple hundred core data stores (sqlite with WAL) that are loaded into a single persistent store coordinator at launch. When the application is launch from within Xcode (using release or debug builds, with the debugger on or off), everything loads up fine---zero complaints. However, when the application is launch from the Finder, the first 'several' persistent stores are loaded fine, but then eventually they start failing to load. E.g.,
Error Domain=NSCocoaErrorDomain Code=256 "The file couldn’t be opened." UserInfo=0x618000278d80
{NSSQLiteErrorDomain=14, NSUnderlyingException=I/O error for database at /Users/path/SomeStore.sql.
SQLite error code:14, 'unable to open database file'}
What could possibly be going on here?
It's worth noting that the application actually creates two separate persistent store coordinators, one for main thread use and the other for background thread use, that load the same files. However, loading is synchronized so the two coordinates aren't doing this at the same time.
Also, the stores are being loaded sequentially---no weird threading going here.
Any ideas are appreciated---thanks,
Jeffrey