Since upgrading to High Sierra, I've been getting these warnings when my core data application terminates:
BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by API violation: vnode unlinked while in use
I haven't seen any actual problems, but I'm wondering if there is some tear down code I should have added in applicationShouldTerminate()?
At the moment all I do is save the context if it has changes before returning .terminateNow.
OK, I figured it out. Since my persistent store contained sensitive data, I was encrypting the files on disk as the final step before shutting down. However, the Core Data stack was still referencing them at this point in the close down process.
The solution was to add code to remove the persistent stores before running the code to encrypt the files.
for store in managedObjectContext!.persistentStoreCoordinator!.persistentStores {
try! managedObjectContext!.persistentStoreCoordinator!.remove(store)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With