如何保持在后台运行的 iPhone 应用程序完全可操作 [英] How to keep an iPhone app running on background fully operational

查看:186
本文介绍了如何保持在后台运行的 iPhone 应用程序完全可操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我知道仅支持 voip、音频和定位应用程序在后台运行,并且它们将在播放音频或使用定位服务等时运行.

first of all, I know there is only support for voip, audio and location apps to run in background and that they will run just while the audio is been played or while using location services, etc.

我想知道的是,是否有办法让我的应用程序在后台完全运行,不管对电池寿命的影响.

What I want to know is if there is a way to keep my app running on background fully operational, doesn't matter the impact on battery's life.

这样,我的应用程序的用户可以从设置中进行选择,以便在他想要的任何时候并且只在他希望的时间内保持应用程序的活动.例如,如果他正在等待需要运行应用程序的东西,则在收到消息后,他可以关闭保持活动功能.

That way the user of my app can select from settings to keep alive the app whenever he wants and just for the amount of time he wish. e.g if he is waiting for something that requires the app to be running, after receiving the messages he can turn off the keep alive functionality.

我不知道这是否可能,但我读过一些这样说的帖子,但不幸的是他们没有说如何 =(

I don't know if this is possible but I had read some post that say so but unfortunately they didn't say how to =(

更新:在 本教程,我发现 Acrobits 在 Apple Store 上有两个应用程序可以强制应用程序在后台保持活动和唤醒".那么有办法做到这一点吗?

UPDATE: In this tutorial, I found that Acrobits has two apps on the Apple Store that "can force the application to stay alive and awake in the background". So there is a way to do this?

推荐答案

您可以在应用程序被定向到后台后的有限时间内执行任务,但仅限于提供的持续时间.运行时间超过此时间将导致您的应用程序终止.请参阅Completing a Long-Running Task in the Background" 部分的 iOS 应用程序编程指南了解如何执行此操作.

You can perform tasks for a limited time after your application is directed to go to the background, but only for the duration provided. Running for longer than this will cause your application to be terminated. See the "Completing a Long-Running Task in the Background" section of the iOS Application Programming Guide for how to go about this.

其他人已将在后台播放音频作为后台进程保持活力的一种手段,但 Apple 仅在音频播放是合法功能的情况下才会接受此类应用程序.Apple 发布的审查指南第 2.16 条规定:

Others have piggybacked on playing audio in the background as a means of staying alive as a background process, but Apple will only accept such an application if the audio playback is a legitimate function. Item 2.16 on Apple's published review guidelines states:

多任务应用程序只能使用为他们预期的后台服务用途:VoIP、音频播放、位置,任务完成,本地通知等

Multitasking apps may only use background services for their intended purposes: VoIP, audio playback, location, task completion, local notifications, etc

这篇关于如何保持在后台运行的 iPhone 应用程序完全可操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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