Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

com.rxjava.rxlife.OutsideScopeException: View is not attached #17

Closed
mycrossroads opened this issue May 28, 2021 · 1 comment
Closed

Comments

@mycrossroads
Copy link

自定义view,经常性的报这个错误,有什么好的方式避免么?
com.rxjava.rxlife.OutsideScopeException: View is not attached!
at com.rxjava.rxlife.ViewScope.onScopeStart(ViewScope.java:45)
at com.rxjava.rxlife.AbstractLifecycle.addObserverOnMain(AbstractLifecycle.java:58)
at com.rxjava.rxlife.AbstractLifecycle.addObserver(AbstractLifecycle.java:34)
at com.rxjava.rxlife.LifeObserver.onSubscribe(LifeObserver.java:29)
at io.reactivex.internal.operators.observable.ObservableDetach$DetachObserver.onSubscribe(ObservableDetach.java:66)

@liujingxing
Copy link
Owner

这是因为你的view还没添加到窗口上就发请求了,RxLife.asXxx/toXxx方法第二个参数传入true可以避免这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants