Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How programmatically restart an iPhone app in iOS

Tags:

ios

iphone

ios6

How programmatically restart an iPhone app in iOS?

I find this way http://writeitstudios.com/david/?p=54

But may be something simple.

like image 801
Andrei Eremchuk Avatar asked Nov 21 '10 16:11

Andrei Eremchuk


1 Answers

The only way I know to do this is not ideal, but it works.

First, your app has to opt out of background execution (multitasking) The app has to quit when exited, not run as a background task. This is done with the plist key UIApplicationExitsOnSuspend.

Second, your app needs to register a custom URL scheme that can be used to launch the app.

Third, you need a web page hosted somewhere that when loaded will redirect to your app's custom URL scheme.

Forth, the user needs an active Internet connection.

To exit and restart, call UIApplication openURL on your hosted redirecting web page. Your app will exit and safari will launch and load your page. The page will redirect Safari to your custom URL scheme, prompting Safari to internally call openURL, causing iOS to launch your app.

like image 81
TomSwift Avatar answered Sep 22 '22 04:09

TomSwift