【发布时间】:2020-09-25 08:09:57
【问题描述】:
我在 Cordova CLI 上开发一个项目并在物理 iPhone 上编译 APP,但在控制台中出现 Access Control Origin 错误。
这是消息:
[Error] Origin null is not allowed by Access-Control-Allow-Origin.
[Error] Failed to load resource: Origin null is not allowed by Access-Control-Allow-Origin. (bootstrap.min.css, line 0)
错误来自本地文件,也来自 ajax。
我的config.xml的配置是:
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="14" defaultlocale="es-ES" id="com..." version="2.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>TEXT</name>
<description>TEXT</description>
<author email="MYEMAIL" href="MYURL">
MYNAME
</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="*" />
<preference name="windows-target-version" value="10.0" />
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
在我项目的所有 html 文件中,元数据是:
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src * data: content:; connect-src *;">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
我项目的数据是:
Cordova version 10.0.0
cordova-ios version 6.1.1
有人可以帮我解决问题吗? 非常感谢你
【问题讨论】:
标签: cordova cordova-ios