我有一个带下载功能的iOS应用程序。 它将文件下载到临时文件夹,然后将其移动到特殊文件夹。 但是这个过程可能会受到来电的干扰。 当应用程序在后台运行足够长时间时,下载过程可能会因系统杀死应用程序而消失。 我想知道是否有一个很好的策略来解决它。 我能想到的一个解决方案是检测来电并在应用再次启动时恢复下载。 你有什么建议吗? 谢谢!
I have an iOS app with downloading function. It downloads a file to a temporary folder and then move it to a special folder. But the process can be disturbed by an incoming phone call. When the app is in background for enough long time, the downloading process is gone maybe due to the system killed the app. I wonder if there is a good strategy for solving it. One solution that I can think is to detect the incoming phone call and resume the downloading when the app starts again. Do you have any suggestions? Thanks!
最满意答案
对于下载,您可以使用iOS 7中引入的后台传输服务 。即使您的应用程序被推送到后台并且下载需要很长时间,也可以继续下载。
如果需要,您还可以使用操作系统中的可能事件暂停/恢复下载。
For downloading you can use the background transfer service introduced in iOS 7. This allows the download to continue even if your application is pushed to background and the download takes a long time.
You can also pause/resume the download if needed using possible events from the OS.
更多推荐
发布评论