Post

Replies

Boosts

Views

Activity

Reply to NSFileProtection confusion
I use the CoreData template provided by Apple... I got the following code to work: let container = NSPersistentContainer(name: "MyApp") let storeDirectory = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first! let url = storeDirectory.appendingPathComponent("MyApp.sqlite") let description = NSPersistentStoreDescription(url: url) description.shouldInferMappingModelAutomatically = true description.shouldMigrateStoreAutomatically = true description.setOption(FileProtectionType.completeUnlessOpen as NSObject, forKey: NSPersistentStoreFileProtectionKey) container.persistentStoreDescriptions = [description] container.loadPersistentStores(completionHandler: { (storeDescription, error) in ... }
Nov ’20