开发者

Restarting iPhone application after [UIApplication sharedApplication] openURL

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.


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


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]];


just use

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

It will return to the app after call finished


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜