iphone – 通过避免应用程序10分钟的时间限制,持续在后台工作

iphone – 通过避免应用程序10分钟的时间限制,持续在后台工作,第1张

概述我想创建一种服务类应用程序,它在后台运行但问题是在iOS应用程序中有10分钟的限制. 我们有什么方法可以连续运行我们的应用程序,我已经阅读了一些内容,如果我们在后台播放一首歌,那么应用程序永远不会在10分钟后终止,但我不认为苹果会批准这一点. 任何建议都会有所帮助. 来自iOS开发人员库: iOS 7 supports two new background execution modes for 我想创建一种服务类应用程序,它在后台运行但问题是在iOS应用程序中有10分钟的限制.

@H_502_8@

我们有什么方法可以连续运行我们的应用程序,我已经阅读了一些内容,如果我们在后台播放一首歌,那么应用程序永远不会在10分钟后终止,但我不认为苹果会批准这一点.@H_502_8@

任何建议都会有所帮助.@H_502_8@解决方法 来自iOS开发人员库:

@H_502_8@

@H_502_8@

iOS 7 supports two new background execution modes for apps:@H_502_8@

Apps that regularly require new content can register with the system
and be woken up or launched periodically to download that content in
the background. To register,include the uibackgroundmodes key with
the fetch value in your app’s Info.pList file,and set the minimum
time you want between fetch operations using the
setMinimumBackgroundFetchInterval: method. You must also implement the
application:performFetchWithCompletionHandler: method in your app
delegate to perform any downloads. Apps that use push notifications to
notify the user that new content is available can Now use those
notifications to initiate background download operations. To support
this mode,include the uibackgroundmodes key with the
remote-notification value in your app’s Info.pList file. Your app
delegate must also implement the
application:dIDReceiveRemoteNotification:fetchCompletionHandler:
method.@H_502_8@

第一种情况:
通过设置setMinimumBackgroundFetchInterval:以UIApplicationBackgroundFetchIntervalMinimum或在几秒钟内任何其他号码(您的AppDelegate内)会通知您的应用程序需要更新其内容,即使它是在后台系统.@H_502_8@

请注意.获取间隔是最小值而不是最大值!因此,当系统决定时,您的应用会被唤醒.这可能是一天一次或一天多次.在我的情况下,我的应用程序正在更新约.每10分钟一直到19:00.在那之后,花了大约.下次更新需要7个小时,下次更新需要3个小时.第二天,相同(每10分钟至19:00).@H_502_8@

如果您要求从互联网定期更新(高效和低电量消耗),这种技术是理想的,但不适用于需要在短时间内更新的内容,如电池电量或电池状态.@H_502_8@

希望这可以帮助.@H_502_8@

iOS 7仍处于测试版.因此,上述所有内容可能会更改或更新,直到正式发布@H_502_8@ 总结

以上是内存溢出为你收集整理的iphone – 通过避免应用程序10分钟的时间限制,持续在后台工作全部内容,希望文章能够帮你解决iphone – 通过避免应用程序10分钟的时间限制,持续在后台工作所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1080972.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存