Search code examples
iosvoip

VoIP App do not relaunch after terminating


I'm working on a VoIP app.

When my app enters background, my VoIP socket works well, and the app can receive calls from other users, but when I terminate my app manually (from the multi-task dock at the bottom of iPhone screen), my App doesn't receive any calls.

In the official Apple reference, it says that VoIP App will relaunch in background when the app exits or system reboot. I know I have to reconnect my VoIP server in the didFinishLaunchingWithOptions method, and I have done that, But it seems not working. I doubt whether the didFinishLaunchingWithOptions method have been executed, because I did't see any log to indicate that (I have add NSLog(@"did launch") at the first line of method didFinishLaunchingWithOptions, but I have not see the log text).

Can anyone help me? Thanks.


Solution

  • It's not possible to get any event once app is terminated, to relaunch it you must need to click on application icon again, or in case of push notification app will relaunch by selecting notification message.

    Can you share link of apple's official reference document which you referred?

    If your application is in background in that case you can get events.

    Here in document comment is like,

    "Because VoIP apps need to stay running in order to receive incoming calls, the system automatically relaunches the app if it exits with a nonzero exit code. (This type of exit could happen when there is memory pressure and your app is terminated as a result.) However, terminating the app also releases all of its sockets, including the one used to maintain the VoIP service connection. Therefore, when the app is launched, it always needs to create its sockets from scratch."

    When you terminate application manually exit code will be zero, so application will not get any events, if os will terminate app with other issues application will automatically relaunches by system.