Apps that regularly update their content by contacting a server can
register with the system and be launched periodically to retrIEve that
content in the background. To register,include theuibackgroundmodes
key with thefetch
value in your app’sInfo.pList
file. Then,when
your app is launched,call thesetMinimumBackgroundFetchInterval:
method to determine how often it receives update messages. Finally,
you must also implement the
application:performFetchWithCompletionHandler:
method in your app
delegate.
在内部,application:performFetchWithCompletionHandler:
,在你必须调用completionHandler之前,总共需要30秒才能完成你需要做的事情.绝对建议尽快执行您的民意调查,并在完成执行后立即调用completionHandler.如果您未在指定的30秒内调用它,您的应用将暂停从后台获取.或者,如果您开始花费很长时间进行每次提取,那么您的应用将来获得后台提取的机会将会减少.
或者,如果您希望在收到推送通知时执行其他代码:
总结Apps that use push notifications to notify the user that new content
is available can fetch the content in the background. To support this
mode,include theuibackgroundmodes
key with theremote-notification
value in your app’sInfo.pList
file. You must also implement the
application:dIDReceiveRemoteNotification:fetchCompletionHandler:
method in your app delegate.
以上是内存溢出为你收集整理的如何在iOS 7应用上启用后台更新全部内容,希望文章能够帮你解决如何在iOS 7应用上启用后台更新所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)