RxSwiftCommunity / Action

Abstracts actions to be performed in RxSwift.
MIT License
875 stars 150 forks source link

alertController 结合 Alamofire会报错 #237

Open lumangmang opened 3 years ago

lumangmang commented 3 years ago

cell.followButton.rx.action = CocoaAction { [weak self] _ in return Observable.create { [weak self] observer -> Disposable in let alertController = UIAlertController(title: "Hello world", message: "This alert was triggered by a button action", preferredStyle: .alert) var ok = UIAlertAction.Action("OK", style: .default) ok.rx.action = CocoaAction { [weak self] in guard let self = self else { return .empty() } return self.viewModel.unfollowing(item.outputs.user.id) .do(onCompleted: { observer.onCompleted() }) } alertController.addAction(ok) self?.present(alertController, animated: true, completion: nil) return Disposables.create() } }

会报出异常: didReceive(_:target:): Received networking error: underlying(Alamofire.AFError.explicitlyCancelled, nil)