Closed allanevargas closed 3 years ago
Read The Solution in this thread for my fix
See the thread for the fix
Which thread please ?
See the thread for the fix
Which thread please ?
This one. The fix that worked for me is under The Solution on my first post of this thread.
See the thread for the fix
Which thread please ?
This one. The fix that worked for me is under The Solution on my first post of this thread.
There is no link on all of your SOLUTION messages. can you Kindly type the link ?
This thread was initially a question regarding my issue but now seem to have found a fix so I thought I would update it so others with a similar issue could apply the fix to their application.
The Issue My initial issue was that I had to upgrade my
UIWebView
application to useWKWebView
as it was getting rejected when I submitted it to the app store. So I upgraded toWKWebView
but this caused issues for my app. I have an ionic-v1 app that communicates with my backend which is all PHP. I use PHP$_SESSION
variables for my backend and when I upgraded toWKWebView
, this caused my$_SESSION
variables to be lost on each page so it failed to retrieve data. I then inspected this using the Safari dev tools and noticed that for each HTTP request, it was using a differentPHPSESSID/Cookie
rather than re-using the one when the session was started. This wasn't the case for Android, it worked fine and it was using the same session ID every single request until it was destroyed.The Solution Now, this might not work for you but do check my versions of dependencies and plugins down below. There was a lot of trial and error on my part after searching for a fix and I really tried to avoid a fix that would only work for a certain version of iOS, Cordova, etc.
I installed this plugin:
ionic cordova plugin add cordova-plugin-wkwebview-file-xhr
Javascript/AngularJS I already set this globally to my project
$httpProvider.defaults.withCredentials = true;
Here is a sample HTTP request that's used throughout my appPHP Header Files
Cordova Version 10.0.0
cordova-ios Version 6.1.1
macOS macOS Big Sur Version 11.1
Safari Version Version 14.0.2
Xcode Version Version 12.3
Config.xml
Plugin List