在iPhone中长时间在后台运行应用 [英] To run app in background for long time in iphone

查看:60
本文介绍了在iPhone中长时间在后台运行应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在后台运行我的应用程序直到退出它.为此,我使用了下面的代码

Hi I want to run my app in background until I quit it.For that I have used the code below

 bgTask = [application beginBackgroundTaskWithExpirationHandler: ^{
            dispatch_async(dispatch_get_main_queue(), ^{

                [application endBackgroundTask:bgTask];
                bgTask = UIBackgroundTaskInvalid;

            });
        }]; 

但是它在特定时间后退出.任何人都可以指导我实现这一目标.

but it quits after particular time.Can any one guide me to achieve this.

推荐答案

您不知道!

Apple将允许您完成冗长的操作,但不要让您的应用程序运行.这样会耗尽电池电量.

Apple will allow you to complete a lengthy operation, but it is not ment to keep your app running. This will drain your battery.

Apple支持三种后台运行的应用程序:音频播放器,VOIP客户端和基于位置的应用程序.基于位置的应用只会收到主要的位置更新,并且一次只能运行一个音频播放器.

There are three kind of background running apps support by Apple: Audio player, VOIP client and location based apps. Location based apps will only receive major location updates and only one audio player can run at a time.

使用后台模式会使您的应用被拒绝.

Mis use of the background mode will get you app rejected.

这篇关于在iPhone中长时间在后台运行应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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