可以从Web链接启动iOS应用程序

可以从Web链接启动iOS应用程序

本文介绍了可以从Web链接启动iOS应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序将用户退出应用程序进入safari进行一些网络事务(使用webview进行玩弄,但还有其他关于布局,使用,重新启动应用程序,服务器错误等的问题)。当它们完成后,我希望在最终网页上有一个链接,让他们重新启动应用程序。我认为这应该可以通过某种协议实现(例如href =myAppProtocol://重新启动),但我不知道如何正确实现它。

My app bounces the user out of the app into safari to do some web things (toying with using a webview but there are other concerns regarding layout, usage, re-launching the app, server errors, etc.). When they are done I would like a link on the final web page that lets them re-launch the app. I think this should be possible through a protocol implementation of some sort (such as href="myAppProtocol://relaunch") but I don't know how to go about implementing it properly.

[更新](无法回答我自己的问题,所以在这里进行编辑)

[UPDATE] (can't answer my own question yet so editing here)

在发布之后偶然发现(看了几个小时,这总是如何结合......)

Stumbled across this just after posting (hours of looking and this is always how it comes together...) http://mobileorchard.com/apple-approved-iphone-inter-process-communication/

在plist中使用URL类型处理程序(我怀疑)你可以声明你的app处理url那种类型(比如myAppProtocol)。 iOS然后启动您的应用程序,并在触摸safari时将其交给URL。你从那里做的事情取决于你,我只需要启动所以我不再采取任何措施,但你可以获取URL并解析它以获得进一步的传递信息等。

Using a URL type handler in your plist (as I suspected) you can declare that your app handles urls of that type (say "myAppProtocol"). iOS then launches your app and hands it the URL when it's touched in safari. What you do from there is up to you, I just need to launch so I don't take it any further, but you could grab the URL and parse it out for further passed information etc.

推荐答案

我猜你已经找到了答案,但也看了一下这些文档:。

I guess you found the answer already, but have a look at the docs as well: Using URL Schemes to Communicate with Apps.

这篇关于可以从Web链接启动iOS应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 01:38