Observer.onError firing off inconsistently

前端 未结 2 1007

I am using Retrofit to access my API as follows:

public interface UserService {
    ...
    @POST(\"/user/login\")
    public Observable register(@Bo         


        
2条回答
  •  忘掉有多难
    2021-02-14 10:06

    you can use unsafe unsafeSubscribe.

    ...
    .subscribeOn(Schedulers.newThread())
    .observeOn(AndroidSchedulers.mainThread())
    .unsafeSubscribe(new Observer() {
        @Override
        public void onCompleted() {
        ....
        }
    
        @Override
        public void onError(Throwable e) {
        ....
        }
    
        @Override
        public void onNext(User user) {
        ....
        }
    });
    ...
    

提交回复
热议问题