Fix bad callback thread in restore purchases

This commit is contained in:
Davide De Rosa 2021-02-04 11:32:21 +01:00
parent 6c84217a0f
commit 9566bac598
1 changed files with 8 additions and 4 deletions

View File

@ -294,14 +294,18 @@ extension ProductManager: SKRequestDelegate {
guard finished else {
return
}
self?.restoreCompletionHandler?(error)
self?.restoreCompletionHandler = nil
DispatchQueue.main.async {
self?.restoreCompletionHandler?(error)
self?.restoreCompletionHandler = nil
}
}
}
public func request(_ request: SKRequest, didFailWithError error: Error) {
restoreCompletionHandler?(error)
restoreCompletionHandler = nil
DispatchQueue.main.async { [weak self] in
self?.restoreCompletionHandler?(error)
self?.restoreCompletionHandler = nil
}
}
}