ios – 如果应用程序被任务管理器杀死,NSUrlSession会继续文件传输吗?

ios – 如果应用程序被任务管理器杀死,NSUrlSession会继续文件传输吗?,第1张

概述我已经尝试了网上的各种样本(最后一个是 this one),以便更好地理解NSUrlSession. 我希望看到的内容:即使触发它们的应用程序被杀死(例如用户通过任务管理器),文件下载仍将继续.然而,这似乎没有发生. 如果应用程序被终止,这是配置问题还是后台文件传输不起作用? 我认为整个想法是iOS将重启应用程序. 如果系统终止您的应用并且您的后台会话具有有效下载,则您的下载将继续,系统将在下载完 我已经尝试了网上的各种样本(最后一个是 this one),以便更好地理解NSUrlSession.

我希望看到的内容:即使触发它们的应用程序被杀死(例如用户通过任务管理器),文件下载仍将继续.然而,这似乎没有发生.

如果应用程序被终止,这是配置问题还是后台文件传输不起作用?
我认为整个想法是iOS将重启应用程序.

解决方法 如果系统终止您的应用并且您的后台会话具有有效下载,则您的下载将继续,系统将在下载完成后启动您的应用.但是,如果用户强制退出您的应用,则会取消所有任务.

Documentation for backgroundSessionConfigurationWithIdentifier:

If an iOS app is terminated by the system and @R_938_4404@ed,the app can
use the same IDentifIEr to create a new configuration object and
session and retrIEve the status of transfers that were in progress at
the time of termination. This behavior applIEs only for normal
termination of the app by the system. If the user terminates the app from the multitasking screen,the system cancels all of the session’s background transfers. In addition,the system does not automatically @R_938_4404@ apps that were force quit by the user. The user must explicitly @R_938_4404@ the app before transfers can begin again.

总结

以上是内存溢出为你收集整理的ios – 如果应用程序被任务管理器杀死,NSUrlSession会继续文件传输吗?全部内容,希望文章能够帮你解决ios – 如果应用程序被任务管理器杀死,NSUrlSession会继续文件传输吗?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1104279.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存