iOS后台获取自定义间隔 [英] iOS background fetch custom interval

查看:117
本文介绍了iOS后台获取自定义间隔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了有关背景提取的所有Apple文档,目前我正在使用它:

I read all Apple documentation about background fetch and currently I'm using it like this:

[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:minimumBackgroundFetchInterval];

我让操作系统决定何时执行后台提取,但如果我这样设置:

I let OS to decide when to perform background fetch, but if I set it like this:

[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:21600];

这是否意味着每6小时会进行一次获取?

Does that mean that fetch will happen every 6h?

推荐答案

不,这意味着您建议iOS在执行后台提取之前至少要经过六个小时,但此属性的文档说明了 -

No, it means that you are suggesting to iOS that at least six hours should elapse before a background fetch is performed, but the documentation for this property states -


可以启动另一个
后台提取之前必须经过的最小秒数。此值仅供参考,
并不表示获取
操作之间预期的确切时间。

The minimum number of seconds that must elapse before another background fetch can be initiated. This value is advisory only and does not indicate the exact amount of time expected between fetch operations.

因此,在执行后台提取之前可能需要超过六个小时,但可能不会更少。 iOS还会记录您通过完成处理程序返回的值,指示是否有新数据可以尝试确定您的应用可能有新数据的当天时间。

So, it could be more than six hours before a background fetch is performed but probably won't be any less. iOS also takes note of the value you return via the completion handler indicating whether there was new data or not to try and determine the times of the day when there is likely to be new data for your app.

这篇关于iOS后台获取自定义间隔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆