mirror of
https://github.com/Ferrite-iOS/Ferrite.git
synced 2026-04-21 08:52:00 +00:00
DataManagement: Load background context after persistent store
Removes the CoreData warning on startup. Signed-off-by: kingbri <bdashore3@gmail.com>
This commit is contained in:
parent
24b86335d5
commit
6a90dab386
1 changed files with 5 additions and 4 deletions
|
|
@ -36,15 +36,16 @@ struct PersistenceController {
|
||||||
container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
|
container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
|
||||||
try? container.viewContext.setQueryGenerationFrom(.current)
|
try? container.viewContext.setQueryGenerationFrom(.current)
|
||||||
|
|
||||||
backgroundContext = container.newBackgroundContext()
|
|
||||||
backgroundContext.automaticallyMergesChangesFromParent = true
|
|
||||||
backgroundContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
|
|
||||||
try? backgroundContext.setQueryGenerationFrom(.current)
|
|
||||||
container.loadPersistentStores { _, error in
|
container.loadPersistentStores { _, error in
|
||||||
if let error = error {
|
if let error = error {
|
||||||
fatalError("CoreData init error: \(error)")
|
fatalError("CoreData init error: \(error)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backgroundContext = container.newBackgroundContext()
|
||||||
|
backgroundContext.automaticallyMergesChangesFromParent = true
|
||||||
|
backgroundContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
|
||||||
|
try? backgroundContext.setQueryGenerationFrom(.current)
|
||||||
}
|
}
|
||||||
|
|
||||||
func save(_ context: NSManagedObjectContext? = nil) {
|
func save(_ context: NSManagedObjectContext? = nil) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue