I'm using Swift 4 and the NSPersistentContainer for a very simple data model. I have 1 entity and several attributes plus one index. When I first created this the app was saving the data in a real store. Then I added one attribute and the index and setup to migrate automatically. Now the CoreData debug output shows me: CoreData: annotation: Connecting to sqlite database file at "/dev/null" Because of this my data is not saved between sessions. Is there a way to specify the sqlite db file? Can I get back to the old file?
var dataContainer: NSPersistentContainer = {
let container = NSPersistentContainer(name: "MyProject")
// Auto migrate data to new version
let description = NSPersistentStoreDescription()
description.shouldMigrateStoreAutomatically = true
description.shouldInferMappingModelAutomatically = true
container.persistentStoreDescriptions = [description]
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error {
let msg = "\(error)"
os_log("dataContainer: loadPersistentStores Error = %@", msg)
}
})
container.viewContext.name = "MyProject"
return container
}()