Check for context changes within a performBlock

This commit is contained in:
V-Ken Chin 2016-09-13 15:36:21 +10:00
parent 1239ddb9a7
commit fde476d57b

View File

@ -53,16 +53,16 @@ public class CoreDataDefaultStorage: Storage {
catch {
_error = error
}
if self.rootSavingContext.hasChanges {
self.rootSavingContext.performBlockAndWait({
self.rootSavingContext.performBlockAndWait({
if self.rootSavingContext.hasChanges {
do {
try self.rootSavingContext.save()
}
catch {
_error = error
}
})
}
}
})
})
} catch {
_error = error