仅HTTP支持Cordova iOS Cross跨源请求 [英] Cordova iOS Cross origin requests are only supported for HTTP
问题描述
我正在构建一个iOS应用,最近将cordova-ios升级到4.1.0,并开始使用:cordova-plugin-wkwebview-engine.
I'm building an iOS app and recently upgraded cordova-ios to 4.1.0 and started using: cordova-plugin-wkwebview-engine.
问题是,现在我收到错误消息在尝试加载依赖项时,HTTP仅支持跨源请求
,因此该应用程序将无法启动.
The problem is that now I get the error message Cross origin requests are only supported for HTTP
while trying to load dependencies, so the app won't start.
它正在尝试通过file://加载systemjs依赖项,但我将其包含在config.js中.
It's trying to load systemjs dependencies over file://, but I included in my config.js.
我不知道如何解决此问题.有人有这种行为的经验吗?
I have no clue how to fix this. Does anyone have experience with this bevaviour?
科尔多瓦版本:6.1.0科尔多瓦ios版本:4.1.0
cordova version: 6.1,0 cordova ios version: 4.1.0
相关的config.xml位:
related config.xml bit:
<access origin="*" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
推荐答案
安装以下插件:
cordova plugin add cordova-plugin-wkwebview-engine
cordova plugin add cordova-plugin-wkwebview-file-xhr
cordova plugin add https://github.com/TheMattRay/cordova-plugin-wkwebviewxhrfix
添加到 config.xml
:
<platform name="ios">
...
<preference name="WKWebViewOnly" value="true"/>
...
</platform>
这篇关于仅HTTP支持Cordova iOS Cross跨源请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!