views:

433

answers:

4

Hi,

As title says I'd like to know how to restart my iPhone app after doing this:

[[UIApplication sharedApplication] openURL:[NSURL UrlWithString:@"tel://0123456789"]]

It seems pretty simple as I saw many topics also talking about restoring the very state of the application when openURL is called, but I can't find how to simply restart the app when the calling is finished.

Is it supposed to be the default behavior? As for me, the iPhone opens Favorites after call is finished, I don't know why.

+1  A: 

You can't restart an app after a phone call, as your app has terminated and your code is no longer being run.

If you want to restart after the user visits a webpage, you can put a link with a custom scheme in that webpage, and register it with your app. The user can then tap the link to open your app again.

Jonathan Grynspan
+1  A: 

You can't. Starting an app is solely user's responsibility - which I consider a good thing.

Eiko
Are you sure about that?I don't have it right here but I've already seen an app restarting itself after the call was finished. I didn't know that was possible at that time, and this is what made me search how to do it.
Jukurrpa
The app will come back if someone calls you, but if the user quits the app for any reason, there is no way to bring it back to front.
Eiko
And using openURL will necessarily leave the app? Is there any other way to make a phone call without leaving the application?
Jukurrpa
Making a call brings the phone app to front, thus terminating your app (well, with multitasking it might be suspended instead - but it will hardly make a difference).
Eiko
Alright I still wonder how did the app I was talking about restarted after the call... Thanks for your answers anyways.
Jukurrpa
A: 

http://www.youtube.com/watch?v=oJSTM-A_s_w This app can go back to app after calls.

CYg
A: 

check the discussion here: https://devforums.apple.com/message/128046#128046 create a UIWebView to load the phone url like this:

      UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
      [webview loadRequest:[NSURLRequest requestWithURL:url]];
y.situ