Merge pull request #283 from v-ken/coredata_multithreading_violation_fix

Check for context changes within a performBlock
This commit is contained in:
Pedro Piñera Buendía 2016-09-13 18:11:47 +02:00 committed by GitHub
commit d9b02a8cea

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