Search code examples
xcodecordovawhitelist

Whitelist error in Cordova/Phonegap


I have the following in my 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>

I have added * as an external host which previously has always worked without issue, I am using Cordova 2.2.0 and when trying to make AJAX calls I am getting the White-list error.

I don't see where I am going wrong!


Solution

  • I have changed this part of the XML -

    <array/>
        <key>item 0</key>
        <string>*</string>
    

    To this -

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