Post

Replies

Boosts

Views

Activity

Reply to Removing NSPersistentHistoryTrackingKey causes error.
Example with NSPersistentHistoryTrackingKey: static let containerCloud: NSPersistentCloudKitContainer = { let description = NSPersistentStoreDescription() description.url = SELF.storeURL description.configuration = "CloudKit" description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) description.cloudKitContainerOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: "iCloud.jsblocker") let container = NSPersistentCloudKitContainer(name: "Model") container.persistentStoreDescriptions = [description] container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError("LoadPersistentStores() error \(error), \(error.userInfo)") } else { #if DEBUG print("DB container = CloudKit") #endif } }) return container }()
May ’25
Reply to Core Data complaining about store being opened without persistent history tracking... but I don't think that it has been
Example for NSPersistentHistoryTrackingKey: static let containerLocal: NSPersistentContainer = { let description = NSPersistentStoreDescription() description.url = SELF.storeURL description.configuration = "Default" description.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) description.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) let container = NSPersistentContainer(name: "Model") container.persistentStoreDescriptions = [description] container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError("LoadPersistentStores() error \(error), \(error.userInfo)") } else { #if DEBUG print("DB container = Default") #endif } }) return container }()
May ’25