如何在每1小时后调用一次功能?(斯威夫特)。应用程序终止时后台获取工作? [英] how to call function after every 1 hour?(Swift). Background fetch work when app is terminated?
问题描述
经过多次搜索后我发现后者通过performFetchWithCompletionHandler获取,但我想知道这个函数将起作用应用程序被终止?我的意思是如果我的应用程序处于关闭或终止状态我如何自动调用函数?
你如果您的应用处于终止状态,则无法执行任何操作。 Apple在终止或关闭状态下不允许任何内容(接收通知除外)。
您也受到后台执行的限制。
您可以在后台模式下执行特定类型的任务,例如:位置更新,音乐播放,VOIP,有限长度任务,报亭下载等
。您可以参考苹果文档更多有关背景执行的详细信息。
希望这会有所帮助:)
i am making app. which providing functionality of fetch data after every one hour. so even when my app terminate how can i call that function?
after too much searching i found Background fetching by performFetchWithCompletionHandler but i want to know that this function will work if my app is terminated?what i mean is if my app is in closed or terminated state how can i call function automatically?
You can't do anything if your app is in terminated state. Apple is not allowing anything (except receiving notification) in terminated or closed state.
You are also restricted for background execution also.
You can perform specific kind of task in background mode like : Location update,Music playing, VOIP, finite length task, Newsstand downloads, etc
. You can refer apple documentation for more details about background execution.
Hope this will help :)
这篇关于如何在每1小时后调用一次功能?(斯威夫特)。应用程序终止时后台获取工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!