I made an iOS 8 app that uses the new app groups feature to share a Core Data store with an extension. It worked so well that I thought I would try it with 2 separate apps sharing a Core Data store in an App Group container. But while it worked between App and Extension, I am getting Core Data store corruptions issues when sharing with 2 apps.
Depending on the order in which I open the 2 apps, I get different errors:
Fetches cause this error:
CoreData: error: (522) I/O error for database at /private/var/mobile/Containers/Shared/AppGroup/[…].sqlite. SQLite error code:522, 'not an error’
Saves cause this error:
CoreData: error: (11) Fatal error. The database at /private/var/mobile/Containers/Shared/AppGroup/[...].sqlite is corrupted. SQLite error code:11, 'database disk image is malformed’
Or:
Core Data: error: -executeRequest: encountered exception = error during SQL execution : PRIMARY KEY must be unique with userInfo = { NSFilePath = "/private/var/mobile/Containers/Shared/AppGroup/[...].sqlite"; NSSQLiteErrorDomain = 19; } CoreData: error: (19) PRIMARY KEY must be unique