【问题标题】:PhoneGap Build External URL not loading only in iOS for cli-5.2.0PhoneGap 构建外部 URL 仅在 iOS 中不加载 cli-5.2.0
【发布时间】:2015-11-12 16:28:58
【问题描述】:

下面是我的 PhonegapBuild 的 config.xml 副本 出于某种原因,该应用程序在 Android 上运行良好,但在 iOS 上根本无法运行 没有外部内容加载 当我启用调试时,它不会显示在 WINERE 我已经多次检查我的配置并且不认为我遗漏了任何东西 但显然我是。

我在这里错过了什么?

帮助赞赏

<?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.abcxyz.xxxyyy"
    versionCode = "600001" 
    version     = "6.0.1" >

<!-- 
ANDROID
id          = "com.abcxyz.xxxyyy"

iOS
id          = "com.abcxyz.xxxyyy"


versionCode is optional and Android only 
-->

<name>xxx yyy</name>

<description>
    Track your yyyditioning process using this tool.
</description>

<author href="http://xxxyyy.com" email="support@xxxyyy.com">
    xxxyyy.Com
</author>
<preference name="LoadingPageDialog" value="xxx yyy"/>

<preference name="phonegap-version" value="cli-5.2.0" />


<!-- DEFAULT ICON (ALWAYS ON ROOT DIRECTORY) -->
<icon src="icon.png" />

<icon src="icons/ios/icon.png" gap:platform="ios" width="57" height="57" />
<icon src="icons/ios/icon-72.png" gap:platform="ios" width="72" height="72" />
<icon src="icons/ios/icon-at-2x.png" gap:platform="ios" width="114" height="114" />
<icon src="icons/ios/icon-at-76x76.png" gap:platform="ios" width="76" height="76" />
<icon src="icons/ios/icon-at-120x120.png" gap:platform="ios" width="120" height="120" />
<icon src="icons/ios/icon-at-152x152.png" gap:platform="ios" width="152" height="152" />
<icon src="icons/ios/icon-at-156x156.png" gap:platform="ios" width="156" height="156" />
<!-- retina iPad support: PhoneGap 2.5.0+ only -->
<icon src="icons/ios/icon-72-at-2x.png" gap:platform="ios" width="144" height="144" />

<icon src="icons/android/ldpi.png" gap:platform="android" gap:density="ldpi" />
<icon src="icons/android/mdpi.png" gap:platform="android" gap:density="mdpi" />
<icon src="icons/android/hdpi.png" gap:platform="android" gap:density="hdpi" />
<icon src="icons/android/xhdpi.png" gap:platform="android" gap:density="xhdpi" />

<icon src="icons/winphone/icon.png" gap:platform="winphone" />
<icon src="icons/winphone/icon-173-tile.png" gap:platform="winphone" gap:role="background" />


<gap:splash gap:density="ldpi" gap:platform="android" src="splash/android/ldpi.png" />
<gap:splash gap:density="mdpi" gap:platform="android" src="splash/android/mdpi.png" />
<gap:splash gap:density="hdpi" gap:platform="android" src="splash/android/hdpi.png" />
<gap:splash gap:density="xhdpi" gap:platform="android" src="splash/android/xhdpi.png" />
<gap:splash gap:platform="ios" src="splash/ios/screen-iphone-portrait.png" width="320" height="480" />
<gap:splash gap:platform="ios" src="splash/ios/screen-iphone-portrait-2x.png" width="640" height="960" />
<gap:splash gap:platform="ios" src="splash/ios/screen-iphone5.png" width="640" height="1136" />
<gap:splash gap:platform="ios" src="splash/ios/screen-ipad-portrait.png" width="768" height="1024" />
<gap:splash gap:platform="ios" src="splash/ios/screen-ipad-landscape.png" width="1024" height="768" />
<gap:splash gap:platform="ios" src="splash/ios/screen-ipad-retina-portrait.png" width="2048" height="1496" />
<gap:splash gap:platform="ios" src="splash/ios/screen-ipad-retina-landscape.png" width="1536" height="2048" />
<gap:splash gap:platform="winphone" src="icons/winphone/icon.png" />


<preference name="AutoHideSplashScreen" value="true" />
<preference name="SplashScreenDelay" value="0" />

<preference name="orientation" value="portrait" />
<preference name="webviewbounce" value="false"/>
<preference name="prerendered-icon" value="true" />
<preference name="ios-statusbarstyle" value="black-translucent" />
<preference name="fullscreen" value="true" />
<preference name="stay-in-webview" value="true" />


<!--
<icon src="icon.png"/>
<gap:splash src="assets/images/template/startup_landscape.jpg" height="768" width="1024" gap:platform="ios"/>
<gap:splash src="assets/images/template/startup_portrait.jpg" height="1024" width="768" gap:platform="ios"/>
-->

<gap:plugin name="org.apache.cordova.dialogs" source="npm" />
<gap:plugin name="org.apache.cordova.vibration" source="npm" />
<gap:plugin name="org.apache.cordova.device" source="npm" />
<gap:plugin name="org.apache.cordova.splashscreen" source="npm" />
<gap:plugin name="org.apache.cordova.network-information" source="npm" />
<gap:plugin name="org.apache.cordova.file-transfer" source="npm" />
<gap:plugin name="org.apache.cordova.camera" source="npm" />
<gap:plugin name="org.apache.cordova.file" source="npm" />
<gap:plugin name="org.apache.cordova.media-capture" source="npm" />
<gap:plugin name="org.apache.cordova.console" source="npm" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" version="1.1.0" />

<gap:plugin name="org.madmobile.cordovaplugins.zbarscanner" source="npm" />

<!--
<gap:plugin name="org.madmobile.cordovaplugins.zbar" />

<gap:plugin name="com.phonegap.plugins.barcodescanner" />
<gap:plugin name="org.apache.cordova.contacts" />
<gap:plugin name="org.apache.cordova.geolocation" />
<gap:plugin name="com.phonegap.plugins.pushplugin" />
-->


<!--
<access origin="crictopia.com" subdomains="true" browserOnly="false" />
<access origin="*" />
<access origin="http://app.xxxyyy.com" subdomains="true" />
<access origin="http://app.abcxyz.com" subdomains="true" />
<access origin="http://google.com" subdomains="true" />
<access origin="https://secure.xxxyyy.com" subdomains="true" />
-->
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />

<allow-navigation href="http://*/*" />

【问题讨论】:

  • 您的config.xml 的底部不见了。您可能没有正确应用whitelist。
  • 当您更正此问题时。请回复。
  • 嗨,你解决了吗?如果是,请告诉我。提前致谢。
  • 是的,下面我在元标记中有 Content-Security-Policy 的评论导致了这个问题。

标签: ios cordova phonegap-plugins phonegap-build whitelist


【解决方案1】:

原来问题实际上不是 config.xml

问题在于 index.html 安全设置适用于 android 而不是 iOS

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

只需删除整个标签,生活就很好

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多