PhoneGap构建 - Config.XML - 由于'ConnectionError'导致REST CALL失败

时间:2021-05-30 07:25:19

I've built an application using PhoneGap build using a custom Config.xml:

我使用自定义Config.xml使用PhoneGap构建构建了一个应用程序:

<?xml version='1.0' encoding='utf-8'?>

<widget xmlns   = "http://www.w3.org/ns/widgets"
xmlns:gap   = "http://phonegap.com/ns/1.0"
id          = "com.package"
versionCode = "25"
version     = "1.0.1" >

   <name>TEST APP</name>
   <description>TEST APP</description>

   <icon src="res/img/icon.png" />
   <icon src="res/img/icon.png" platform="android" density="ldpi" />
   <icon src="res/img/icon.png" platform="android" density="mdpi" />
   <icon src="res/img/icon.png" platform="android" density="hdpi" />
   <icon src="res/img/icon.png" platform="android" density="xhdpi" />   

   <feature name="http://api.phonegap.com/1.0/network" />
   <feature name="http://api.phonegap.com/1.0/file" />
   <feature name="http://api.phonegap.com/1.0/device" />

   <gap:plugin name="cordova-plugin-whitelist" source="npm" version="1.0.0" />  
   <access origin="*" />
   <allow-intent href="*" />
   <allow-navigation href="*" />

</widget>

Added Content Security Policy to the index.html:

向index.html添加了内容安全策略:

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

Build does not break - application is submitted to the PlayStore When triggering a REST call from the application on a HTTPS link I get an error:

构建不会中断 - 应用程序提交到PlayStore当在HTTPS链接上从应用程序触发REST调用时,我收到错误:

return status '0' / return status text ''

The application is working locally correct in a browser , so there is no problem on REST / APP level.

应用程序在浏览器中本地正确工作,因此REST / APP级别没有问题。

I have a feeling it has to do with some missing configuration?

我有一种感觉它与一些缺少配置有关吗?

Any help would be welcome!

欢迎任何帮助!

1 个解决方案

#1


1  

@dann, You did not tell phonegap build which version to build. Such as:

@dann,你没有告诉phonegap构建哪个版本。如:

<preference name="phonegap-version" value="3.5.0" />

Since you did not list this "preference", you got the latest version.

由于您没有列出此“首选项”,因此您获得了最新版本。

Also when using whitelist with the latest version of phonegap, I am told you need to add more information to your config.xml. For this you will want to reference the master example https://github.com/phonegap/phonegap-start/blob/master/www/config.xml

此外,当使用带有最新版本phonegap的白名单时,我被告知您需要向config.xml添加更多信息。为此,您需要参考主示例https://github.com/phonegap/phonegap-start/blob/master/www/config.xml

You will likely need to add the pluging

您可能需要添加插件

<plugin name="cordova-plugin-whitelist" version="1" />

If you want to limit your whitelist, instead the broad reference you have now, then read the

如果您想限制白名单,而不是现在的广泛参考,请阅读

Whitelist Guide
http://docs.phonegap.com/en/4.0.0/guide_appdev_whitelist_index.md.html#Whitelist%20Guide

白名单指南http://docs.phonegap.com/en/4.0.0/guide_appdev_whitelist_index.md.html#Whitelist%20Guide

For more help on the whitelist, I recommend the google group:
https://groups.google.com/forum/#!forum/phonegap

有关白名单的更多帮助,我建议使用Google网上论坛:https://groups.google.com/forum/#!forum / phonegap

For more help on Phonegap Build, I recommend the Official forum
http://community.phonegap.com/nitobi

有关Phonegap Build的更多帮助,我推荐官方论坛http://community.phonegap.com/nitobi

#1


1  

@dann, You did not tell phonegap build which version to build. Such as:

@dann,你没有告诉phonegap构建哪个版本。如:

<preference name="phonegap-version" value="3.5.0" />

Since you did not list this "preference", you got the latest version.

由于您没有列出此“首选项”,因此您获得了最新版本。

Also when using whitelist with the latest version of phonegap, I am told you need to add more information to your config.xml. For this you will want to reference the master example https://github.com/phonegap/phonegap-start/blob/master/www/config.xml

此外,当使用带有最新版本phonegap的白名单时,我被告知您需要向config.xml添加更多信息。为此,您需要参考主示例https://github.com/phonegap/phonegap-start/blob/master/www/config.xml

You will likely need to add the pluging

您可能需要添加插件

<plugin name="cordova-plugin-whitelist" version="1" />

If you want to limit your whitelist, instead the broad reference you have now, then read the

如果您想限制白名单,而不是现在的广泛参考,请阅读

Whitelist Guide
http://docs.phonegap.com/en/4.0.0/guide_appdev_whitelist_index.md.html#Whitelist%20Guide

白名单指南http://docs.phonegap.com/en/4.0.0/guide_appdev_whitelist_index.md.html#Whitelist%20Guide

For more help on the whitelist, I recommend the google group:
https://groups.google.com/forum/#!forum/phonegap

有关白名单的更多帮助,我建议使用Google网上论坛:https://groups.google.com/forum/#!forum / phonegap

For more help on Phonegap Build, I recommend the Official forum
http://community.phonegap.com/nitobi

有关Phonegap Build的更多帮助,我推荐官方论坛http://community.phonegap.com/nitobi