ios – 在后台模式下关闭我的应用后会下载简历

我想到可以在后台应用程序模式下载.我在XCode中实现了后台提取模式,并注册了后台任务,并且工作正常.

在用户强制关闭我的申请后,我可以完成下载任务吗?怎么样?

解决方法

不,当您的应用被用户终止时,您无法继续下载!您的应用必须要求保持背景状态!因为如果用户强制关闭app意味着,他不想再运行它了.如果您的应用程序被系统暂停,那么它可以被唤醒,但如果它被用户终止则不会被唤醒!

If an iOS app is terminated by the system and relaunched,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 relaunch apps that were force quit by the user. The user must explicitly relaunch the app before transfers can begin again.

更新:(如评论中所述)

Refer the apple documentation,它说,

This method lets your app know that it is about to be terminated and purged from memory entirely. You should use this method to perform any final clean-up tasks for your app,such as freeing shared resources,saving user data,and invalidating timers. Your implementation of this method has approximately five seconds to perform any tasks and return. If the method does not return before time expires,the system may kill the process altogether.

For apps that do not support background execution or are linked
against iOS 3.x or earlier,this method is always called when the user
quits the app. For apps that support background execution,this method
is generally not called when the user quits the app because the app
simply moves to the background in that case. However,this method may
be called in situations where the app is running in the background
(not suspended) and the system needs to terminate it for some reason.

After calling this method,the app also posts a UIApplicationWillTerminate notification to give interested objects a chance to respond to the transition.

以上是来客网为你收集整理的ios – 在后台模式下关闭我的应用后会下载简历全部内容,希望文章能够帮你解决ios – 在后台模式下关闭我的应用后会下载简历所遇到的程序开发问题。

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