Comments (5)
我明白你的需求了
实现后台下载的第一规则:TRManager必须在App启动时创建
而你这个需求的解决方法:
给AppDelegate添加一个可选属性manager,用户登录的时候,创建独自的manager,identifier跟用户关联,同时赋值给AppDelegate的属性,把identifier保存到沙盒的文件里
在didFinishLaunchingWithOptions方法读沙盒的文件,根据identifier创建manager,同时赋值给AppDelegate的属性,在handleEventsForBackgroundURLSession里就可以拿到对应的manager。
切换用户的时候,应该把当前用户的下载任务都暂停,然后销毁当前用户的manager,再创建新的manager
from tiercel.
我第一次创建 TRManager 并不是在 didFinishLaunchingWithOptions 方法里,然后并不会出现问题,问题出在我切换用户重新构建新的 TRManager 后再去进行下载的时候。
from tiercel.
请你按照我说的方法尝试一下
from tiercel.
必须要在 APP 启动时创建么?我需要根据用户来创建 Manager,但是此时用户还没有登录怎么办呢?我现在发现的问题是,第一次且不在 APP 启动时创建 Manager 并不会有问题,但是重复创建相同 identifier 的 Manager 再进行下载操作就会导致这个崩溃的出现。我试过在 app 启动时创建 manager,之后销毁再重新创建新的有相同 identifier 的 manager(即用户退出登录又重新登录),此时崩溃是必现的。但是创建不同 identifier 的 manager 没有问题(用户换了帐号登录)。
from tiercel.
呃。。。。你好像没理解我说的做法,你先跟着我说的做一边,再去理解这样做的意义。
同一个用户是同一个identifier,此时不销毁manager即可。
from tiercel.
Related Issues (20)
- 运行报错
- 清除
- 多任务下载总进度问题 HOT 2
- 请问多文件下载和批量下载有什么区别呢?
- 下载单个视频,进度一直是0 HOT 5
- 在初始化SessionManager的时候,触发了completion回调 HOT 2
- 最新版本:移动网络4G下下载不了,没有任何回调 HOT 1
- 请问如何给task 拓展一些属性 HOT 1
- 总的进度问题 HOT 2
- 请问借助Tiercel能分片下载吗? HOT 1
- 遇到了企业签以后下载成功,但是没有找到该下载资源 HOT 2
- 后台下载问题 HOT 3
- 不同的流能否按顺序写入同一个文件
- 下载不支持 HOT 1
- 重启APP自动下载问题 HOT 1
- 限速问题 HOT 1
- 没有通过URL删除已下载文件的接口 HOT 1
- 希望大神增加一个 waitsForConnectivity 让使用者来控制断网情况是要等待网络,还是直接失败。 HOT 1
- 后台下载
- VisionPro版本支持 HOT 1
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 tiercel.