By Maxim Kholyavkin

2012-05-01 08:07:13 8 Comments

Skype update text contains next:

App auto restarts if unexpectedly shut down

How is possible to perform that via SDK?


@Fabian Guerra Soto 2014-07-24 19:38:29

The question is why would you want do that?, if your answer is: you want to make an app to run in an "iPad Kiosk" so in case it crashed you need the app to automatically restart, then, what will work for you is put the iPad in "Kiosk mode" and the OS automatically restarts the app in case of crashes.

Take a look at:


@junglecat 2012-05-16 03:33:11

Skype does exactly this:

  1. Registers it's TCP sockets for VoIP.
  2. Logs in.
  3. Upon nonzero exit code the app will be relaunched by iOS (Because VoIP applications need to stay running in order to receive incoming calls, the system automatically relaunches the application if it exits with a nonzero exit code.).
  4. It then immediately starts a background task (Relaunched apps remain suspended).
  5. Next it registers it's login socket for VoIP.
  6. It logs back in.

@Shamsiddin 2017-06-28 06:39:19

Can you provide any apple documentation about paragraph 3?

@anticyclope 2012-05-01 08:30:08

As far as I know, some sort of apps can be run in background and can be restarted in specific case. This is from Apple docs

If you start this service and your application is subsequently terminated, the system automatically relaunches the application into the background if a new event arrives. In such a case, the options dictionary passed to the application:didFinishLaunchingWithOptions: method of your application delegate contains the key UIApplicationLaunchOptionsLocationKey to indicate that your application was launched because of a location event.

My opinion is: Skype is relaunched with remote notifications mechanism.


Well, I think I found something. @Malek_Jundi was half-right. Your app should fail with non-zero exit code, but it should be registered as VoIP application.

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

@Applicasa iOS developer 2012-05-02 13:49:26

But The user has to click on the notificatino message so it isn't auto restart anymore...

@anticyclope 2012-05-02 16:35:57

Presenting alert to user is not the only option, AFAIK. Anyway, just my thoughts on the topic, I don't know how Skype handle this.

@KPK 2012-10-23 22:14:02

This sounds promising though I haven't found any documentation about the automatic restart. Can anyone confirm a successful restart after the app has been terminated by a crash/non-zero return value?

@dropky 2017-05-11 11:45:24

Can you detect restart? When app is killed it appears in the background, I would like to trigger some events after that...

@Sukhi 2012-05-01 08:20:53

Not sure whats with the Skype but - Unfortunately, there's no way to restart the app. Even, there is no way to quit/exit the app. (for quitting, please refer this link section "Don't quit programmatically")

@Malek_Jundi 2012-05-01 08:16:34

as far as I know its not possible to restart your app .. you could kill your app using exit(1); but this is not allowed by Apple and will rejected. maybe you do some workaround by remove some views from the mainViewController and add it again and reset the data and content .. but making a real restart I don't think so.

Related Questions

Sponsored Content

36 Answered Questions

[SOLVED] How to change the name of an iOS app?

  • 2008-10-27 03:07:03
  • Robert Gould
  • 470567 View
  • 985 Score
  • 36 Answer
  • Tags:   ios xcode

95 Answered Questions

9 Answered Questions

12 Answered Questions

[SOLVED] How do I animate constraint changes?

24 Answered Questions

[SOLVED] How to link to apps on the app store

39 Answered Questions

[SOLVED] How can I develop for iPhone using a Windows development machine?

  • 2008-08-22 13:35:01
  • ryan
  • 1110865 View
  • 1184 Score
  • 39 Answer
  • Tags:   ios iphone windows

6 Answered Questions

1 Answered Questions

[SOLVED] How to auto-restart an app after a crash (like Skype 4.0 did)

  • 2012-05-02 13:43:13
  • Applicasa iOS developer
  • 2856 View
  • 1 Score
  • 1 Answer
  • Tags:   ios

1 Answered Questions

[SOLVED] language change only after restart on iphone

Sponsored Content