fix network service background thread crash

This commit is contained in:
Ivan Smolin 2018-03-27 11:43:15 +03:00
parent c7e5687f0b
commit 384180443b
1 changed files with 4 additions and 1 deletions

View File

@ -84,7 +84,10 @@ open class NetworkService {
/// Shows network activity indicator when requests in executed. Works only on iOS.
public func bindToApplicationActivityIndicator() {
bindActivityIndicator()?.disposed(by: disposeBag)
// Fatal error: `drive*` family of methods can be only called from `MainThread`
DispatchQueue.main.async {
bindActivityIndicator()?.disposed(by: self.disposeBag)
}
}
/// Disable showing network activity indicator.