ios - 后台任务和后台正确获取有什么区别?

标签 ios xamarin background-task background-fetch

我正在网上查看一些关于后台任务和后台获取的文档。

后台任务是在应用程序仍在运行时在后台执行的任务。当应用程序处于后台时,任务完成任务的时间有限,一旦完全进入后台,任务也必须结束。

后台获取是指应用程序完全处于后台或非事件状态,如果资源可用,将安排在某个时间点执行操作。

这是我非常简短的理解。

最佳答案

是的,你的理解是对的!让我更深入地解释一下!

后台任务是在后台继续工作的能力。

例如,如果您正在播放 audio 并按下主页按钮,则音频可以在后台继续播放。位置也一样!您可以在后台不断更新位置。这只是示例,还有更多类型在后台运行。您可以将此类内容称为后台任务。可以在后台模式下继续工作的任务称为后台任务。

可以引用Apple doc了解您可以执行或 iOS 允许的后台任务类型。现在 background fetch 完全不同了。如果您的应用程序处于后台或处于非事件状态,它能够定期检查新内容或执行操作。系统在可能的情况下自动在后台唤醒您的应用程序并可以执行一些操作。例如,您可以说 facebook。 Facebook 有时间线,应该定期有新数据,所以它可以使用后台获取从服务器获取数据,无论应用程序是否处于非事件状态!因此,当用户打开应用程序时,他/她可以获得最佳的用户体验,因为内容已经通过 background fetch 下载了!

可以引用Apple doc用于后台获取!它指出,

Apps that need to check for new content periodically can ask the system to wake them up so that they can initiate a fetch operation for that content. To support this mode, enable the Background fetch option from the Background modes section of the Capabilities tab in your Xcode project. (You can also enable this support by including the UIBackgroundModes key with the fetch value in your app’s Info.plist file.) Enabling this mode is not a guarantee that the system will give your app any time to perform background fetches. The system must balance your app’s need to fetch content with the needs of other apps and the system itself. After assessing that information, the system gives time to apps when there are good opportunities to do so.

关于ios - 后台任务和后台正确获取有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44238987/

相关文章:

c# - Xamarin.Mac/Cocoa 相当于 Window Loaded 事件?

c# - 在 Xamarin PCL 中获取线程信息

uwp - 后台任务中的 Toast 通知响应

push-notification - 如果 WP 8.1 应用程序关闭,我们可以收到原始推送通知吗?

ios - PayMill SDK iOS swift 3.0 Xcode 8.1

ios - swift 3.0 : Ambiguous reference to member 'Subscript' issue in push notification

iphone - UIImagePickerController 有时不会初始化相机 View

ios - 有没有办法检查是否单击了 2 个 UIButton?

c# - TextBlob 为空

c# - 分析后台任务的内存使用情况