Cordova-plugin-ionic-webview: iOS 13 beta 6 New Cookie Issues

Created on 21 Aug 2019  Ā·  14Comments  Ā·  Source: ionic-team/cordova-plugin-ionic-webview

Our Ionic 4 application is built with Cordova and uses cordova-plugin-ionic-webview 4.0.1. The API that the application communicates with uses cookies (yes I know this is not recommended, but it's a legacy API). The application works fine on all devices running iOS 11 and 12 but the cookie isn't persisted and sent back with other calls to the API with the iOS 13 betas. I also noticed this same cookie behavior running the application in the iOS Simulator running iOS 12. Did Apple change something with WkWebView and cookies in iOS 13? Has anyone else seen different behavior on-device vs in the Simulator with iOS 12?

-Scott

apple bug

Most helpful comment

First you add to implement this doc : https://ionicframework.com/docs/native/http/#installation
Just do the "usage" section, you're right
Then, http call will only works on real devices.
If you need to enable it in a browser, use https://github.com/sneas/ionic-native-http-connection-backend wich process automatically http call in native language call on real device, and in ajax with rxjs in a browser.
Just follow the instructions

All 14 comments

Yeah, it's an Apple bug, see https://bugs.webkit.org/show_bug.cgi?id=200857

I had the same problem with my ionic 3 app.
I found workarounds using :

By replacing the API calls from rxjs with the native objective C http call, the cookie persist well from the http response of the backend.
Maybe, you can try with this ...

@Stephane84 this looks interesting. How does it behave in the browser when Cordova isn't available? Also, does this also require cordova-plugin-advanced-http as referenced in the 2nd link?

-Scott

@ionic-native/http enable the native http calls only for cordova, you're right
But,the ionic-native-http-connection-backend switch automaticaly betweenrxjs request when you are in a browser, and native call when cordova is enable
see : https://github.com/sneas/ionic-native-http-connection-backend#how-it-works

@Stephane84 thanks, i resolve the same problem.

ionic 3.20
cordova 7.10

npm install --save [email protected]
ionic cordova plugin add cordova-plugin-advanced-http
npm install @ionic-native/[email protected]

@Stephane84

I noticed you posted this workaround in many websites / chat rooms. Would you possibly available for a freelance job to help sort out app out? Added on LinkedIn.

@trademark2k6 , no no, i'm only helping the comunity as i found this bug very critic for me, i wanted to help the more i can do.
It's certainly critic for many other people.
I'm not looking for freelance ;-)
And it learned me something, test on new sdk earlier, because, all regression is possible...

@stephane84 no problems and thanks for the reply. Could you help explain what to do once those plugins are installed? I see the ā€œusageā€ section, on the Ionic framework. Do I simply paste this into one of the files and replace the domain?

Any help appreciated!

First you add to implement this doc : https://ionicframework.com/docs/native/http/#installation
Just do the "usage" section, you're right
Then, http call will only works on real devices.
If you need to enable it in a browser, use https://github.com/sneas/ionic-native-http-connection-backend wich process automatically http call in native language call on real device, and in ajax with rxjs in a browser.
Just follow the instructions

@stephane84
Awesome.

So to be clear, if I only need this for real device, I just need to install and follow the instructions here https://ionicframework.com/docs/native/http/#installation

I do not need to worry about the other link?

Also which file should I copy the ā€œusageā€ code into? The services.ts?

This bug also happens on our ionic-v1 app.
The solution proposed above does not work for me, any other ideas ?

@Stephane84 thanks for sharing. I implemented this in our app and it resolved my iOS 13 cookie issues. It's an interesting combination of the Cordova plugin and the 2 npm packages.

We actually already had advanced http installed. I updated it and it still didn’t work.

We had a funny method to get our app to work. Not sure why it works like this. Would love if anyone can point out any ideas which may help cut down our workflow.

Essentially -
Step 1, add platform [email protected]
Step 2, add webview xhr plugin
Step 3, build iOS, it will fail
Step 4, remove advanced http plugin
Step 5, build iOS again, it will fail again
Step 6, remove webview xhr plugin and add advanced http plugin
Step 7 build again and it will succeed

Open it up in Xcode as usual and build/submit.

BUT if you try to rebuild again, you have to follow all steps again.

Very strange, but it works. Hope it helps anyone else out!

@shuppert @Stephane84 @trademark2k6 Try adding following line inside <platform name="ios"></platform> of config.xml file

<preference name="Hostname" value="your-domain" />

Was this page helpful?
0 / 5 - 0 ratings

Related issues

begbeder picture begbeder  Ā·  5Comments

lincolnthree picture lincolnthree  Ā·  7Comments

50l3r picture 50l3r  Ā·  7Comments

odecharette picture odecharette  Ā·  4Comments

nfischer picture nfischer  Ā·  3Comments