2013-10-03 36 views
0

我在VOIP应用程序中有objective-c目标c中的后台任务

当应用程序处于前台时,SIP调用工作正常。

我的问题是当我的应用程序在后台在去后台10分钟后SIP呼叫不工作。

我在开始了后台任务applicationDidEnterBackground

bgTask = [application beginBackgroundTaskWithExpirationHandler:^{ 

    // Clean up any unfinished task business by marking where you 

    // stopped or ending the task outright. 

    [application endBackgroundTask:bgTask]; 

    bgTask = UIBackgroundTaskInvalid; 

}]; 



// Start the long-running task and return immediately. 

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 



    // Do the work associated with the task, preferably in chunks. 



    [application endBackgroundTask:bgTask]; 

    bgTask = UIBackgroundTaskInvalid; 

}); 

在plist文件UIBackgroundModes设置为VOIP

我在为它的耐心。

请任何身体帮助我。请。

+0

您是否遵循了以下所有步骤:https://developer.apple.com/library/ios/DOCUMENTATION/iPhone/conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html#//apple_ref/doc/uid/TP40007072-CH7 -SW12 – ThomasW

回答

3

根据我的理解,beginBackgroundTaskWithExpirationHandler方法用于在后台执行有限长任务。见Here。而且我无法延长我发现的这10分钟的时间。

由于您的应用程序归类为背景模式所需的应用程序,我不认为你会需要 beginBackgroundTaskWithExpirationHandler。

在上面的链接中阅读“实施VoIP应用程序”部分。它主张使用setKeepAliveTimeout:handler:方法。