Reputation: 4168
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.
Upvotes: 4
Views: 7600
Reputation: 12829
just use
[[UIApplication sharedApplication] openURL:[NSURL UrlWithString:@"telprompt://0123456789"]]
It will return to the app after call finished
Upvotes: 3
Reputation: 2740
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]];
Upvotes: 4
Reputation: 25632
You can't. Starting an app is solely user's responsibility - which I consider a good thing.
Upvotes: 4
Reputation: 43472
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.
Upvotes: 1