在 [UIApplication sharedApplication] openURL 之后重新启动 iPhone 应用程序

发布于 2024-09-10 23:06:04 字数 298 浏览 2 评论 0原文

正如标题所说,我想知道如何在执行此操作后重新启动我的 iPhone 应用程序:

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

看起来很漂亮很简单,因为我看到许多主题也谈论在调用 openURL 时恢复应用程序的状态,但我找不到如何在调用完成后简单地重新启动应用程序。

它应该是默认行为吗?对于我来说,iPhone 通话结束后会打开收藏夹,我不知道为什么。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

鼻尖触碰 2024-09-17 23:06:04

你不能。启动应用程序完全是用户的责任 - 我认为这是一件好事。

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

你是暖光i 2024-09-17 23:06:04

在此处查看讨论:https://devforums.apple.com/message/128046#128046
创建一个 UIWebView 来加载电话网址,如下所示:

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

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]];
梦里的微风 2024-09-17 23:06:04

只需使用

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

通话结束后就会返回到应用程序

just use

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

It will return to the app after call finished

想你的星星会说话 2024-09-17 23:06:04

您无法在通话后重新启动应用程序,因为您的应用程序已终止并且您的代码不再运行。

如果您想在用户访问网页后重新启动,您可以在该网页中放置一个带有自定义方案的链接,并将其注册到您的应用程序中。然后,用户可以点击该链接再次打开您的应用程序。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文