iOS后台获取自定义间隔

编程入门 行业动态 更新时间:2024-10-19 07:37:33
本文介绍了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后台获取自定义间隔

本文发布于:2023-11-28 16:44:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643175.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   间隔   后台   iOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!