简体   繁体   中英

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 . 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.

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.

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://

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: .

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 ).

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?

Problem with xcode 5.0 . Download the xcode version 5.0.1 . Clean all the builds ~/Library/Developer/Xcode/DerivedData/~ . Build again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM