应用程序可以在后台运行多少天

发布于 2024-09-17 22:32:52 字数 138 浏览 2 评论 0原文

我实际上正在对应用程序进行一些日常检查,假设应用程序每天都会关闭和打开。它适用于 3.1 设备。我的问题是应用程序可以在 iPhone 4.0 操作系统的后台运行多少天。

如果它存在很长时间,那么制定每日计划来联系我的后端服务器的最佳方法是什么?

I am actually doing some daily checks of the app assuming the app will be closed and opened daily. It works fine for 3.1 devices. My question is how many days can a app live in background on iPhone 4.0 OS.

If it lives for a long time what are the best ways to make daily schedules to contact my backend server ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

落日海湾 2024-09-24 22:32:52

iOS4 中的后台比这更受限制。您可以安排“任务完成”,但只能运行 10 分钟。您可以执行“位置”后台服务,但这会消耗相当多的电量,而且我不确定它是否会让您像您所说的那样联系您的服务器。

我想对你的问题更直接的回答是这取决于情况。当您在后台时,您需要做好随时关闭应用程序的准备。当设备内存不足时,它将关闭一段时间内未运行的所有应用程序。

Apple 关于后台任务的文档

Backgrounding in iOS4 is more restrict than that. You can schedule 'task completion' but that can only run for 10 minutes. You could possibly do the 'location' background service but that would use quite a bit of power and I'm not sure if it would let you contact your server like you are talking about.

I suppose a more direct answer to your question is that it depends. When you are in the background, you need to be prepared to have you app closed at anytime. When the device runs low on memory, it will close any app that hasn't be run in a while.

Apple's Doc on Background Tasks

雨落□心尘 2024-09-24 22:32:52

为什么说它在 3.1 设备上运行良好?如果您希望应用程序在从跳板打开时进行更新,就像 3.1 中那样,那么您需要在应用程序委托中使用 applicationWillEnterForeground: 来调用正确的代码。

如果您必须在后台定期更新,那么您可以使用 setKeepAliveTimeout:handler: 和 beginBackgroundTaskWithExpirationHandler,但我不知道应用程序商店审核者会如何看待使用它的非 VOIP 应用程序。

Why do you say it works fine for 3.1 devices? If you want the app to update when opened from the springboard like it does in 3.1 then you want to use applicationWillEnterForeground: in your app delegate to call the right code.

If you must update periodically in the background then you can use setKeepAliveTimeout:handler: and beginBackgroundTaskWithExpirationHandler, but I don't know what the app store reviewers will think about a non-VOIP app using using it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文