【问题标题】:Corodva 5.1.1 AJAX call not working I have the whitelist pluginCordova 5.1.1 AJAX 调用不工作我有白名单插件
【发布时间】:2015-09-19 23:07:10
【问题描述】:

我正在尝试将应用程序更新到较新的版本,但我无法让我的登录脚本在 Cordova 5.1.1 版中继续工作。

我根据cordova安装了白名单插件,inappbrowser允许我访问互联网。

我缩短了 config.xml 以允许所有连接。我觉得

配置.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="org.company.app" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>app</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" version="1" />
    <access origin="*" />
    <allow-navigation href="*" />
    <allow-intent href="*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
</widget>

Cordova 插件列表。

cordova-plugin-console 1.0.1 "Console"
cordova-plugin-file 3.0.0 "File"
cordova-plugin-file-transfer 1.2.1 "File Transfer"
cordova-plugin-inappbrowser 1.0.1 "InAppBrowser"
cordova-plugin-media-capture 1.0.1 "Capture"
cordova-plugin-network-information 1.0.1 "Network Information"
cordova-plugin-whitelist 1.0.0 "Whitelist"

【问题讨论】:

  • 如果 iOS9 并使用 xcode,则对安全性进行了更改。我必须更新“info.plist”以允许对我的 api 进行 http 调用。 here 是我引用的链接(如果适用)。

标签: ajax cordova


【解决方案1】:

所以我搬家了

<key>NSAppTransportSecurity</key>  


<dict>  
    <key>NSAllowsArbitraryLoads</key><true/>  
  </dict> 

到我的 plist 文件的顶部,它开始工作。我之前把它放在底部。不完全确定它为什么有效,但确实有效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-26
    • 2016-07-16
    • 1970-01-01
    • 2014-09-19
    • 1970-01-01
    相关资源
    最近更新 更多