0
votes

I have a VOIP application in objective-c

SIP call is working fine when application is in foreground.

My problem is when my app is in background SIP call is not working after 10 minutes after going to background.

I have started a background task in 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;

});

In plist file UIBackgroundModes is set to voip

I am in a patience for it.

Please any body help me. Please.

1

1 Answers

3
votes

By my understanding the beginBackgroundTaskWithExpirationHandler method is used for executing a Finite-Length Task in the Background. See Here. And there is no way extend that period of 10 mins which I have discovered.

Since your app classifies as a background mode required app, I dont think you will be needing beginBackgroundTaskWithExpirationHandler.

Read "Implementing a VoIP App" section in the above link.It advocates the use of setKeepAliveTimeout:handler: method.