在 [UIApplication sharedApplication] openURL 之后重新启动 iPhone 应用程序
正如标题所说,我想知道如何在执行此操作后重新启动我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你不能。启动应用程序完全是用户的责任 - 我认为这是一件好事。
You can't. Starting an app is solely user's responsibility - which I consider a good thing.
在此处查看讨论:https://devforums.apple.com/message/128046#128046
创建一个 UIWebView 来加载电话网址,如下所示:
check the discussion here: https://devforums.apple.com/message/128046#128046
create a UIWebView to load the phone url like this:
只需使用
通话结束后就会返回到应用程序
just use
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.