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¶m2=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.
Related
Problems
I'm using react-native for our current services, and we are sending cookies to our webpage to send information which is needed to seen in our webview. These process is working PERFECTLY in android devices, but not in IOS. (The most annoying thing is set-cookie works sometimes in IOS in same condition. It just randomly succeeded, and I cannot find the reason why.)
How To Reprouce
First of all, these are the stacks we are currently using.
Application: React-Native
Webview: react-native-webview (https://github.com/react-native-webview/react-native-webview)
Cookie: #react-native-cookies/cookies (https://github.com/react-native-cookies/cookies)
Webpage: React (Already deployed in AWS)
Cookie: react-cookie (useCookie)
And the following is our process we are currently doing.
If the user clicks a button (I will call this button as 'Apply' button), it navigates to screen that includes <WebView />
This is a abstract of our webview screen code (For our security issue, I just abstracted and changed some code for it, so if you think more information for our code, please let me know.)
Rendering Page
enter image description here
WebView Component
enter image description here
Send Cookie
enter image description here
Send Cookie Function
enter image description here
(This function is kinda messy bc this is a collective code from 3 files, and I tried my best to set cookie differently with android. (The same logic with android doesn't work in IOS))
Webpage (Launched in AWS)
enter image description here
I Want My Code To Do This
I want my code to send cookie in loading state, and after loading, when the webview rendered, the webpage get some cookie and based on that cookie, it shows some data.
It PERFECTLY works on Android, but not in IOS. It works randomly in IOS so I have no idea what the heck is wrong with this code and hard to define a problem.
I tried...
Someone said to me to add '.' infront of domain. It worked for the very first time, but after the second trial, it starts to not working again
I also tried clear all cookie data before set cookie using
await CookieManager.clearAll();
, but it works same as the first measure I tried.
I also tried to use webkit. I send all true arguments to use webkit while using cookiemanager, but it has no effect.
I expected to do...
As I write in the above, I hope the cookie is rightly set in both android and ios environment, perfectly works in both platform.
We currently support wildcarding for Universal Links. So my applinks looks like: applinks:*.company.com.
Let's say I want to only handle a link if it is https://company.com/?query1=abc
Let's say I instead tap on a link that is https://company.com/?query1=123
Since the condition is not met, I want to ignore this link and prevent my iOS App from responding to it. Is this possible?
I thought I'd just be able to return false in continue:restorationHandler but that does not prevent the iOS App from opening.
Returning false from application(_:continue:restorationHandler:) doesn't result in the URL being passed back to Safari (as you have discovered). The documentation states:
If you don't implement this method or if your implementation returns false, iOS tries to create a document for your app to open using a URL
So returning false just results in iOS trying to launch your app in a different way.
What you can do is call open(_:options:completionHandler:) and pass the URL you received. The URL will then be opened in Safari; iOS won't pass your app a universal link that your app opens itself because that could create an infinite loop.
I'm developing an iOS application in which I want to provide users with a payment gateway, which is a web page. I'm showing this web page in a WebView.
The payment gateway accepts 2 URL params - success and failure URL, which are the URLs users is redirected to after completing purchase. Redirect is done via JavaScript location.href property and works properly in desktop browser and Android app.
I've set the URLs to let's say tft://redirect/success?id=123 resp. tft://redirect/failure?id=123
I want my app to handle this redirect and show Success or Failure message to user.
I followed many tutorials including Apple's docs.
First of all I'm not sure why Apple docs show scheme without slashes (myphotoapp: instead of myphotoapp:// - does it make a real difference?)
I've registered custom scheme tft and implemented the func application(..) function according to the docs.
Now when the redirect should happen, nothing really happens, the func application is not called at all.
I started development with iOS 12 and recently switched deployment target to 13.5, however, the project structure didn't change (scene delegate missing - is it an issue?).
Can you please give me any direction?
Thanks in advance.
According to https://stackoverflow.com/a/37240425/9046249 custom scheme behaves somewhat wierd. When I switched the scheme to http or https it works like a charm.
I know it's possible to pass data from one app to another app on the same device using custom url schemes or protocol handlers.
Is it possible to pass data from one app to another app that isn't installed? Ideally the user would be taken to the app store for the uninstalled app, the user would download the uninstalled app, and the custom url scheme from the original app would still pass the data to the newly installed app.
Is that possible?
Is it possible to pass data from one app to another app that isn't
installed?
YES.
using the x-callback parameters, we can ask the target app to call us back on our own URLs, even handling success and error scenarios.Sort of like custom HTTP headers, these callback parameters are identified with an x- namespace:
x-error : URL to open if the requested action generates an error in the target app. This URL will be open with at least the parameters “errorCode=code&errorMessage=message. If x-error is not present, and a error occurs, it is assumed the target app will report the failure to the user and remain in the target app.
x-source : The friendly name of the source app calling the action.
x-success : If the action in the target method is intended to return a result to the source app, the x-callback parameter should be included and provide a URL to open to return to the source app. On completion of the action, the target app will open this URL, possibly with additional parameters tacked on to return a result to the source app. If x-success is not provided, it is assumed that the user will stay in the target app on successful completion of the action.
I am running into a situation which I am not sure is possible from technical/design point of view. Please advise.
Here is what I need:
I have an open URL registered for my native iOS app. I expect a request ID to be passed along with it and once hit I open that request.
From within my native iOS app, I need to open a web page in the webview. This page has few buttons in it.
A tap on the button in the webview should open the request inside my app. So, I want to trigger the registered open URL in step #1.
Web page data is dynamic and will change on the fly.
Is this a feasible design. Shall I consider something else.
Any advise/pointers will be appreciated.
This should be possible. Here's a though:
1: Implement the UIWebview delegate method shouldStartLoadWithRequest.
2: when you intercept that your webview is attempting to access the url yourapp://blah-blah-blah you can return NO instead dip into your appdelegate can manually call the function handleOpenURL.
I've seen something similar in the past with supporting oAuth (I believe it was with instagram) within one of our apps. We basically loaded up the login page in a UIWebview and then when we detected the the post login redirect we parsed the oAuth token from the url and called it good.
Good luck