Open signalpoint opened 3 years ago
@signalpoint We will have look into your use case and respond soon.
I'm running into this problem as well, have you guys figured out a way to solve it by any chance? :) @signalpoint @manish2788
Edit: I overlooked the workaround in CDVWKWebViewFileXhr.m
, this worked for me as well. :)
Interesting to note that I've had reports of this error effecting some users but couldn't recreate it using the same url on a up to date test device. Until we realised the users with the error were on iOS v16.2.
It does look like the NSURL class has had the parser updated in iOS v17, see https://developer.apple.com/documentation/foundation/nsurl#1663756
For apps linked on or after iOS 17 and aligned OS versions, NSURL parsing has updated from the obsolete RFC 1738/1808 parsing to the same RFC 3986 parsing as NSURLComponents. This unifies the parsing behaviors of the NSURL and NSURLComponents APIs. Now, NSURL automatically percent- and IDNA-encodes invalid characters to help create a valid URL.
Thank you for this plugin, it really saved the day with regards to cordova + ios + xhr + cookies!
I wanted to point out an issue I had with the plugin though. For example, I am making a POST to a URL like this:
https://example.com/?q=api/foo.json&api-key=abc123!_^-etc
With
NativeXHRLogging
set tofull
, this error was being thrown to the Console:After some Googling, it seems that
NSURL
may need some encoding.To get around this, I added a one line patch to
performNativeXHR()
inCDVWKWebViewFileXhr.m
:I'm guessing if I were to encode the URL's query string parameters beforehand, that would eliminate the error (and the need for the patch). However, I haven't had to use
encodeURIComponent()
on either theq
orapi-key
query string parameters for any other client environment (e.g. cordova + android, web apps, older versions ios + cordova), so I wanted to document this situation for others that may experience it.Thank you again, and I hope this is helpful.