从safari返回应用程序 [英] Return to app from safari

查看:125
本文介绍了从safari返回应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,当用户点击按钮时,我会将用户重定向到Safari浏览器,按钮会关闭应用程序并打开Safari浏览器。这没有问题。它工作正常。问题是当用户退出Safari浏览器时,我想将用户重定向回应用程序,而不是主屏幕。任何想法请...

In my application, I redirect the user to the safari browser when he/she taps on a button, which in turn closes the application and opens the safari browser. There is no problem in that. It works fine. The thing is when the user quits the safari browser, I want to redirect the user back to the application, not the home screen. Any idea please...

推荐答案

如果您控制要重定向到的网站,那么您可以在该网站使用自定义网址,我将在下面详细介绍。但如果它是你无法控制的网站,你可以让用户使用UIWebView在你的应用程序中浏览。

If you control the website that you are redirecting them to, then you can place a link on the site using custom URL which I describe in more details below. But if it's a site you don't control, you can have the user surf within your app using the UIWebView.

对于iOS应用程序,你可以创建自定义URL方案您的应用程序注册到系统。然后在网页上,您将使用该自定义URL创建链接。这就是Apple如何通过移动版Safari发布telephone.app或mail.app。

For an iOS app, you can create custom URL schemes that your app register with the system. Then on the web page you would create a link using that custom URL. That is how Apple launches the telephone.app or the mail.app from mobile safari.

例如:假设你的应用是BigBadApp。您的自定义网址为:bigbadapp://现在,您可以创建指向您应用的链接:< a href =bigbadapp:// launchfromsafari>启动BigBadApp< / a> 您可以使用自定义URL将任何类型的信息传回您的应用,您的应用将在应用代理中处理该信息。对于iOS 4.2及更高版本: application:openURL:sourceApplication:annotation:。早期版本的iOS上的旧代表的名称是application:handleOpenURL:

For example: Let say your app is call BigBadApp. You custom URL would be: bigbadapp:// Now, you could create a link to your app would be: <a href="bigbadapp://launchedfromsafari">Launch BigBadApp</a> You can pass any kind of information back to your app using the custom URL and your app will handle that information in the app delegate. For iOS 4.2 and later: application:openURL:sourceApplication:annotation:. The name of old delegate on earlier version of iOS is application:handleOpenURL:

有关详细信息,请参阅Apple 实施自定义网址方案
另外iOS开发人员:提示有关于通过自定义网址方案启动自己的应用程序

For more information see check Apple Implementing Custom URL Schemes. Also iOS developer:tips has a tutorial on Launching Your Own Application via a Custom URL Scheme.

这篇关于从safari返回应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆