简体   繁体   English

无法从iOS 7中的UIWebView调用应用程序(URL方案)

[英]Impossible to call application (URL Scheme) from UIWebView in iOS 7

A bit of an odd situation. 有点奇怪的情况。 We work with an outside partner, which exposes a webpage where their users can log in. This webpage takes a parameter called returnURL . 我们与外部合作伙伴合作,该合作伙伴公开了一个可供用户登录的网页。该网页采用名为returnURL的参数。 This returnURL will be called upon successful login to their service and at the end of this return URL our outside partner will add a token that we can use afterwards in the application. 成功登录他们的服务后,将调用returnURL ,在此返回URL的末尾,我们的外部合作伙伴将添加一个令牌,供以后在应用程序中使用。

Because I work in iOS, as a returnURL I am giving my application's URL scheme, so that the webpage can call it when the login is done. 因为我在iOS中工作,所以我作为应用程序的URL方案作为returnURL,以便登录后网页可以调用它。

So, it goes like this. 因此,它像这样。 Their webpage: 他们的网页:

http://www.theirwebpage.com/?param1=x&param2=y&returnURL=myAppsName://

I show the webpage in a webview and within application:openURL:sourceApplication:annotation: I have the code for the return, where I parse the parameters passed with myAppsName:// 我在application:openURL:sourceApplication:annotation:以及application:openURL:sourceApplication:annotation:显示该网页application:openURL:sourceApplication:annotation:我有返回的代码,在这里我解析了通过myAppsName://传递的参数

The Problem 问题

This whole process works fine on iOS 6, as the webview will call the URL scheme of the application, which will trigger application:openURL:sourceApplication:annotation: . 整个过程在iOS 6上运行良好,因为Webview会调用应用程序的URL方案,这将触发application:openURL:sourceApplication:annotation:

However, the application:openURL:sourceApplication:annotation: method never gets called in iOS 7. It seems more like the webview calls itself the myAppsName://{parameters} and then fails (for a further explanation, the UIWebView calls webView:didFailLoadWithError: and within its NSErrorFailingURLKey we can find the full myAppsName://extraParam1=bar&token=foo ). 但是,在iOS 7中永远不会调用application:openURL:sourceApplication:annotation:方法。似乎webview本身将其自身称为myAppsName://{parameters} ,然后失败(有关进一步的解释,UIWebView会调用webView:didFailLoadWithError:并且在其NSErrorFailingURLKey我们可以找到完整的myAppsName://extraParam1=bar&token=foo )。

Is there a change that happened in iOS 7, where this type of call (from a UIWebView to the application itself) is no longer permitted? iOS 7是否发生了更改,不再允许这种类型的调用(从UIWebView到应用程序本身)?

Problem with xcode 5.0 . xcode 5.0出现问题。 Download the xcode version 5.0.1 . 下载xcode版本5.0.1。 Clean all the builds ~/Library/Developer/Xcode/DerivedData/~ . 清理所有版本〜/ Library / Developer / Xcode / DerivedData /〜。 Build again. 重新构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用自定义URL方案将数据从UIWebView发送回iOS应用程序使用Xcode 8 / iOS 10 - Sending Data from a UIWebView back to an iOS Application with a custom URL Scheme breaks with Xcode 8/iOS 10 通过自定义URL方案调用iOS应用程序 - Call iOS application via Custom URL Scheme 从另一个应用程序在 ios 中启动应用程序的 URL 方案的替代方案? - alternative of URL scheme for launching application in ios from another application? iOS:获取应用程序的URL方案 - iOS: Get URL Scheme of Application 在 iOS 上使用 Whatsapp url scheme 调用 - Call Using Whatsapp url scheme on iOS URL Scheme iOS | 以编程方式开源应用程序 - URL Scheme iOS | Open Source Application Programmtically 在UIWebView中使用自定义URL方案 - Using a custom URL scheme with UIWebView 用于从 iOS 应用程序(语音呼叫 VOIP)以编程方式进行 WhatsApp 呼叫的 URL 方案? - Url scheme for making WhatsApp call programmatically from iOS app (voice call VOIP)? iOS:从 UIWebView 中的 URL 加载音频时出现问题 - iOS: Problem Loading Audio from URL in UIWebView 通过URL方案打开完全退出的应用未在iOS中从postNotificationName调用该函数 - Open fully quitted app from URL scheme did not call the function from postNotificationName in iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM