Search code examples
ioscore-data

Is persistent history tracking in CoreData supported with legacy stack and Objective C?


Is it possible to implement Persistent History Tracking in an application/framework written in Objective C where Core Data stack has been setup manually in legacy manner? Or does persistent history tracking work only when persistent store was initialised by NSPersistentContainer available from iOS 10 onwards?


Solution

  • NSPersistentContainer is a convenience but is not necessary. If you're not using it, you also don't have NSPersistentStoreDescription, so you'll set any custom options on your persistent store coordinator instead. If you check out the docs for NSPersistentStoreCoordinator you'll see that persistent history tracking is one of the available options.

    Persistent history tracking was added in iOS 11, so it won't work on earlier versions of iOS regardless of how you set up Core Data.