Comments (8)
都叫scopeNetLife
了肯定要跟随ViewModel生命周期, 这是简单的基础
from net.
能fork仓库复现或者证明此问题吗?
麻烦提供代码, 因为我并不能复现此问题, 并且程序怎么存在随机
from net.
用Life
的话,考虑是否被Lifecycle
cancel() 了?
这个要看你调用处的源码
Net/net/src/main/java/com/drake/net/scope/AndroidScope.kt
Lines 51 to 55 in 40d8998
from net.
![image](https://private-user-images.githubusercontent.com/91582747/299535870-8f05ae49-9b0e-4644-9eff-8643c16abe6e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg1MTk0MzQsIm5iZiI6MTcxODUxOTEzNCwicGF0aCI6Ii85MTU4Mjc0Ny8yOTk1MzU4NzAtOGYwNWFlNDktOWIwZS00NjQ0LTllZmYtODY0M2MxNmFiZTZlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE2VDA2MjUzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkyMTIwMmQ3ZGI2M2VmNGE1ZWUyZjE3MDVlMWYzYmFkMTRlZDdiMzk2MTZlMmJlODQ1MDRmM2Y1ZDI3ZTFlODQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.2WiAy13I8t9WJwrcVgWRLtnztQ6SJ1-VFaQAXQIzLc8)
代码就是 直接 调用 当前 ViewModel 的该扩展 函数,刚 debug跑了, 后面调到 NetCoroutineScope 类的 launch 函数,不会执行:
from net.
![image](https://private-user-images.githubusercontent.com/91582747/299535870-8f05ae49-9b0e-4644-9eff-8643c16abe6e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg1MTk0MzQsIm5iZiI6MTcxODUxOTEzNCwicGF0aCI6Ii85MTU4Mjc0Ny8yOTk1MzU4NzAtOGYwNWFlNDktOWIwZS00NjQ0LTllZmYtODY0M2MxNmFiZTZlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE2VDA2MjUzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTkyMTIwMmQ3ZGI2M2VmNGE1ZWUyZjE3MDVlMWYzYmFkMTRlZDdiMzk2MTZlMmJlODQ1MDRmM2Y1ZDI3ZTFlODQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.2WiAy13I8t9WJwrcVgWRLtnztQ6SJ1-VFaQAXQIzLc8)
代码就是 直接 调用 当前 ViewModel 的该扩展 函数,刚 debug跑了, 后面调到 NetCoroutineScope 类的 launch 函数,不会执行:
from net.
ViewModel也有生命周期
from net.
ViewModel也有生命周期
onCrear()后, 是在哪处理了 不再执行 launch 了?,系统处理的吗?
from net.
ViewModel.onClear()
后代表ViewModel生命周期结束, 不执行很正常, 除非你不使用ViewModel.scopeNetLife
from net.
Related Issues (20)
- runMain 方法的优化咨询 HOT 2
- 请教强哥json请求问题 HOT 2
- Failed to resolve: com.github.liangjingkanji:Net:3.5.8 Failed to resolve: com.github.liangjingkanji:StateLayout:1.4.1 HOT 4
- 东哥,有没有专门搞下载库的意思 HOT 9
- 此框架会请求2次接口问题 HOT 2
- BodyRequest解析好像有问题 HOT 1
- 关闭网络之后发起请求,app直接崩溃了,不走ErrorHandler的onError方法 HOT 2
- 每次发请求都会创建NetCoroutineScope这样好吗? HOT 4
- 支持请求失败重试吗? HOT 1
- java.net.ProtocolException: unexpected end of stream HOT 3
- 提示 URLParseException 地址错误 HOT 1
- 全局配置仿IOS菊花加载框
- 作者嘴太臭了,大家别用 HOT 4
- 大佬,后续有计划适配Cronet吗? HOT 1
- Get 请求如何参数数组? HOT 2
- 打包可以把源码打上来吗? HOT 1
- 超时的设置问题 HOT 3
- lifecycle版本升级后报错 HOT 4
- 多个同步请求的问题 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from net.