为什么后台任务在10分钟后结束 [英] Why background task is ending after 10 minutes

查看:91
本文介绍了为什么后台任务在10分钟后结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当应用程序处于后台时,我总是急需一个后台任务来运行。

I am badly in need of a background task to run always, when application is in background.

这是一个voip应用程序所需要的。所有步骤都是为voip app完成的。

It is needed for a voip application. All steps are done for voip app.

我使用以下脚本来运行后台任务

I am using following script to run background task

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    UIApplication *app = [UIApplication sharedApplication];
    UIBackgroundTaskIdentifier bgTask;
    self.bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
        [app endBackgroundTask:self.bgTask];
    }];
}

使用后,当应用程序进入后台时,如果喝了一口,在10分钟内来电 UILocalnotification 出现。但是10分钟之后,如果一个小小的呼叫来了,UILocalnotification没有出现。

After using it, when application goes to background, within 10 minutes if a sip call comes UILocalnotification appear. but after 10 minutes if a sip call comes UILocalnotification did not appear.

请有人帮助我。

推荐答案

您是否已将 voip 作为后台模式添加到应用程序中的 UIBackgroundModes Info.plist 文件?

Have you added voip as a background mode to the UIBackgroundModes key in your application Info.plist file?

这篇关于为什么后台任务在10分钟后结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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