Cordova / Phonegap中的白名单错误

时间:2012-11-15 19:03:02

标签: xcode cordova whitelist

我在Cordova.plist中有以下内容

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>KeyboardDisplayRequiresUserAction</key>
    <true/>
    <key>SuppressesIncrementalRendering</key>
    <false/>
    <key>UIWebViewBounce</key>
    <false/>
    <key>TopActivityIndicator</key>
    <string>gray</string>
    <key>EnableLocation</key>
    <false/>
    <key>EnableViewportScale</key>
    <false/>
    <key>AutoHideSplashScreen</key>
    <true/>
    <key>ShowSplashScreenSpinner</key>
    <true/>
    <key>MediaPlaybackRequiresUserAction</key>
    <false/>
    <key>AllowInlineMediaPlayback</key>
    <false/>
    <key>OpenAllWhitelistURLsInWebView</key>
    <false/>
    <key>BackupWebStorage</key>
    <string>cloud</string>
    <key>ExternalHosts</key>
    <array/>
    <key>item 0</key>
    <string>*</string>
    <key>Plugins</key>
    <dict>
        <key>NavigationBar</key>
        <string>NavigationBar</string>
        <key>EmailComposer</key>
        <string>EmailComposer</string>
        <key>Device</key>
        <string>CDVDevice</string>
        <key>TabBar</key>
        <string>TabBar</string>
        <key>Logger</key>
        <string>CDVLogger</string>
        <key>Compass</key>
        <string>CDVLocation</string>
        <key>Accelerometer</key>
        <string>CDVAccelerometer</string>
        <key>Camera</key>
        <string>CDVCamera</string>
        <key>NetworkStatus</key>
        <string>CDVConnection</string>
        <key>Contacts</key>
        <string>CDVContacts</string>
        <key>Debug Console</key>
        <string>CDVDebugConsole</string>
        <key>Echo</key>
        <string>CDVEcho</string>
        <key>File</key>
        <string>CDVFile</string>
        <key>FileTransfer</key>
        <string>CDVFileTransfer</string>
        <key>Geolocation</key>
        <string>CDVLocation</string>
        <key>Notification</key>
        <string>CDVNotification</string>
        <key>Media</key>
        <string>CDVSound</string>
        <key>Capture</key>
        <string>CDVCapture</string>
        <key>SplashScreen</key>
        <string>CDVSplashScreen</string>
        <key>Battery</key>
        <string>CDVBattery</string>
        <key>Globalization</key>
        <string>CDVGlobalization</string>
    </dict>
</dict>
</plist>

我添加了*作为外部主机,以前一直没有问题,我正在使用Cordova 2.2.0,当我尝试进行AJAX调用时,我收到了白名单错误。

我不知道我哪里出错!

1 个答案:

答案 0 :(得分:0)

我更改了XML -

的这一部分
<array/>
    <key>item 0</key>
    <string>*</string>

对此 -

<key>ExternalHosts</key>
    <array>
        <string>*</string>
    </array>