fix crash when NetworkService creates lazy in background thread (globalinit_*_func0)
This commit is contained in:
parent
3969199df7
commit
7c92ef47e0
|
|
@ -26,9 +26,12 @@ extension NetworkService {
|
|||
|
||||
/// Let netwrok service automatically show / hide activity indicator
|
||||
public func bindActivityIndicator() -> Disposable {
|
||||
return requestCount
|
||||
.map { $0 != 0 }
|
||||
.drive(UIApplication.shared.rx.isNetworkActivityIndicatorVisible)
|
||||
// Fatal error: `drive*` family of methods can be only called from `MainThread`
|
||||
return DispatchQueue.main.sync {
|
||||
requestCount
|
||||
.map { $0 != 0 }
|
||||
.drive(UIApplication.shared.rx.isNetworkActivityIndicatorVisible)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue