Return to main queue after getting notified of the dispatch group completion. Fixes #2863
This commit is contained in:
parent
2b816fee4b
commit
2dd475e71d
|
@ -310,20 +310,22 @@ final class CloudKitAccountDelegate: AccountDelegate {
|
|||
}
|
||||
|
||||
group.notify(queue: DispatchQueue.global(qos: .background)) {
|
||||
guard !errorOccurred else {
|
||||
self.refreshProgress.completeTask()
|
||||
completion(.failure(CloudKitAccountDelegateError.unknown))
|
||||
return
|
||||
}
|
||||
|
||||
self.accountZone.removeFolder(folder) { result in
|
||||
self.refreshProgress.completeTask()
|
||||
switch result {
|
||||
case .success:
|
||||
account.removeFolder(folder)
|
||||
completion(.success(()))
|
||||
case .failure(let error):
|
||||
completion(.failure(error))
|
||||
DispatchQueue.main.async {
|
||||
guard !errorOccurred else {
|
||||
self.refreshProgress.completeTask()
|
||||
completion(.failure(CloudKitAccountDelegateError.unknown))
|
||||
return
|
||||
}
|
||||
|
||||
self.accountZone.removeFolder(folder) { result in
|
||||
self.refreshProgress.completeTask()
|
||||
switch result {
|
||||
case .success:
|
||||
account.removeFolder(folder)
|
||||
completion(.success(()))
|
||||
case .failure(let error):
|
||||
completion(.failure(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue