类似至Android AlarmManager iOS的后台进程 [英] iOS background process similar to Android AlarmManager

查看:176
本文介绍了类似至Android AlarmManager iOS的后台进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安排一个固定的任务,检查从互联网上以固定间隔定时一些信息。

I've to schedule a fixed task that check some info from internet at fixed interval timer.

进入Android的,我用AlarmManager与setRepeating,但我新手到iOS。
还有一些类似的API,帮助我吗?我需要生存,当应用程序被操作系统杀死的任务。

Into Android, I use AlarmManager with setRepeating, but I'm newbie to iOS. There are some similar api that help me? I need a task that survive when app is killed by operating system.

你知道关于它的教程?

推荐答案

检查<链接href=\"http://developer.apple.com/library/ios/DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW24\"相对=nofollow>苹果的多任务指南的增加是VoIP的标记 UIBackgroundModes 在Info.plist中,并使用<一个href=\"http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/instm/UIApplication/setKeepAliveTimeout%3ahandler%3a\"相对=nofollow> setKeepAliveTimeout:处理器:UIApplication的的方法如果需要的话,一旦应用程序是临睡前重新启动它。

Check link on Apple's Multitasking Guide that add's the voip tag to UIBackgroundModes in Info.plist and use setKeepAliveTimeout:handler: method of UIApplication to relaunch it if needed once the app is going to sleep.

请注意:为此,您需要从苹果的特殊权限,大多苹果拒绝这些应用程序

Note : For this you need to take special permissions from Apple and mostly Apple rejects such app.

另一种解决方案: -

Another solution :-

您可以存储上次同步日期,如果同步日期已经越过你的间隔时,应用程序来自于背景,你就可以开始同步您的数据。

You can store last sync date and if sync date has crossed your interval when application comes from background, you can start sync your data.

希望这有助于信息你..

Hope this info helps you..

这篇关于类似至Android AlarmManager iOS的后台进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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