Search code examples
iossqlitecore-datansincrementalstore

Obtain Core Data persistent NSSQLiteStoreType store accessible as NSIncrementalStore


Apple Core Data documentation says that iOS's built-in SQLite Store (NSSQLiteStoreType) is an incremental store.

However, if I create a store of this type (by adding it to a NSPersistentStoreCoordinator) it exists apparently as an instance of the (iOS-internal) class NSSQLCore and [store isKindOfClass: NSIncrementalStore.class] returns NO.

Is it possible to obtain from iOS an instance of an SQLLite Store that can be accessed as an NSIncrementalStore?

I'd like to add caching to a custom NSIncrementalStore and employ a wrapped SQLite Store for that purpose, if that's possible (straightforward).


Solution

  • No, it is not possible.

    At best you could create your own NSIncrementalStore implementation that duplicates what the built in store does but that would be a tremendous amount of effort and would violate the design intentions of the of the store.

    The internal design of the SQLite file that Core Data uses is considered internal and will change without notice. It is not recommended that you reverse engineer it.