解决方法
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.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。