iOS 15 Breaks with custom headers
See original GitHub issueBug Report
We are busy reviewing our apps to get ready for iOS 15 changes. We have noticed when using a basic JS fetch and supplying custom headers the encounters an error. This is problematic especially if the the fetches require headers such as tokens, authorization ect.
This appears to only occur when using the scheme and host name options.
<preference name="scheme" value="http" />
<preference name="hostname" value="localhost" />
Problem
Web Error
Failed to load resource: WebKit encountered an internal error
XCode Error
[Process] 0x128ad1000 - NetworkProcessProxy::didClose (Network Process 0 crash)
[assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
What is expected to happen?
At least a success or catch error should return on the js fetch
What does actually happen?
Xcode returns a error and the fetch does not execute
Information
We have tested a simple fetches, one without custom headers and one with custom headers. We also setup a minimal app without any plugins to isolate the issue. This issue does seem to originate from CDVWebViewEngine when scheme and hostname are used.
This all still works on iOS 14.6, so it appears to be something on iOS 15.0 that has changed.
Command or Code
What works
fetch(`https://everydaydigital.co.za/lab/tests/test.php`).then(r => {
return r.json();
}).then(response => {
console.log(response);
}).catch(err => {
console.warn(err);
});
What doesn’t work
fetch(`https://everydaydigital.co.za/lab/tests/test.php`,{
headers : {
'token' : '123456789'
}
}).then(r => {
return r.json();
}).then(response => {
console.log(response);
}).catch(err => {
console.warn(err);
});
Environment, Platform, Device
Mac OS XCode 13 Simulator
Version information
Cordova 10.0 Cordova iOS 6.2.0
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
Which is hopefully fixed in beta 2 and/or public beta 1.
I just updated to the latest beta and it’s broken again unfortunately. I commented on the WebKit bug again.
Let’s hope the next betas are working again.