CDVWKWebViewFileXhr not found after upgrading to Cordova iOS 7.1.1 (works in 7.1.0)
Issue Description
After upgrading from Cordova iOS 7.1.0 to 7.1.1, the plugin cordova-plugin-wkwebview-file-xhr
fails to register. At runtime I get:
ERROR: Plugin 'CDVWKWebViewFileXhr' not found, or is not a CDVPlugin
This used to work fine on Cordova iOS 7.1.0.
Steps to Reproduce
- Create a new Cordova project.
- Add platform:
cordova platform add [email protected] - Add plugins:
cordova-plugin-wkwebview-file-xhr- (other default plugins like device, splashscreen, whitelist, etc.)
- Build and run on iOS.
- Observe runtime logs.
Expected Result
CDVWKWebViewFileXhrshould be found and registered as a valid CDVPlugin.- XHR/fetch to local files should work inside WKWebView.
Actual Result
- App crashes with error:
ERROR: Plugin 'CDVWKWebViewFileXhr' not found, or is not a CDVPlugin
- The plugin is installed (appears in
cordova plugin listand exists underplatforms/ios/Plugins)
Environment
- Cordova CLI: 12.0.0
- Cordova iOS: 7.1.1 (works fine on 7.1.0)
- Xcode: 16.4
- Salesforce Mobile SDK: 13.0.2 (hybrid app)
Additional Notes
- Same configuration works in Cordova iOS 7.1.0.
- Issue appears only after moving to 7.1.1.
- Possibly related to plugin mapping/registration changes in 7.1.1.
You should not use cordova-plugin-wkwebview-file-xhr and instead use a scheme and hostname to get a proper origin for your app. Also you will get as bonus detailed script errors on ios if you do so. Set this in your config.xml and remove the plugin cordova-plugin-wkwebview-file-xhr:
<platform name="ios">
<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />
</platform>
If you still must use cordova-plugin-wkwebview-file-xhr and have problems with it, you should raise an issue on the plugin cordova-plugin-wkwebview-file-xhr, but i see, you already did it: https://github.com/oracle/cordova-plugin-wkwebview-file-xhr/issues/95