PhoneGap Gotcha : ERROR whitelist rejection

On November 22, 2011, in Mobile, by Anuj Gakhar

I have been doing my first PhoneGap App today and as part of the exercise, I am using jQuery Mobile 1.0, PhoneGap 1.2 on Xcode 4.2 on my MacBook Pro. The first thing I did was to copy/paste some code from jQuery Mobile site into my HTML page. I won’t be pasting the entire code here but I was trying to include jQuery Mobile JS/CSS files in the page.

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>

And then I had some other HTML as well. However, when I tried to run the Build, in the Debug Area in XCode, I saw the following error come up :-

SampleApp[549:17803] ERROR whitelist rejection: url='http://code.jquery.com/jquery-1.6.4.min.js'

“Whitelist Rejection” – Immediately I knew it was something to do with URLs not being accessible.

Solution

A quick Google Search confirmed that and the solution is easy. In your PhoneGap.plist file, you need to add the allowed URLs to the ExternalHosts array. I added “*” as I did not want to add each individual URL separately to the list but that’s your choice.

Tagged with:  

35 Responses to PhoneGap Gotcha : ERROR whitelist rejection

  1. Daniel says:

    Hi,

    thanks! You saved my day! ;)

  2. Sandeep says:

    Whitelist rejection causes due to the URL given in Xcode can not identify that address.
    Please check on this URL.
    http://www.prosoxi.com/2011/10/08/xcode-phonegap-white-list-rejection/

  3. Easwar says:

    Really great.. Thanks for saving my time

  4. kris says:

    Thx… you saved my time!!

  5. Daren says:

    perfect, I had been going round in circles on this one!

  6. Philip says:

    Will whitelisting * cause problem with approval from App Store?

  7. luismiKG says:

    Exelente!!! me había atorado ya desde hace 3 días!! :S con eso!!

  8. Paul says:

    Thanks a lot!!

  9. Ranjith says:

    Thanks….I enjoyed

  10. Mihalis says:

    Thanks mate, that was useful!

  11. Thank you!

    Been searching for two days for a solution :)

    /Patrik

  12. Chirag says:

    Thanks…

  13. Si Chen says:

    That was the right solution. Thanks!

  14. Anuj Tyagi says:

    Thanks Anuj!!! Your post helped me a lot…. :o).

  15. Ankur sarda says:

    Thanks buddy u save our time…:)

  16. dm says:

    Спасибо огромное!)

  17. A slightly better explanation of the issue and the solution is here…
    http://davehiren.blogspot.com/2012/03/whitelist-rejection-error-in-xcode-for.html

    Still looking for why phonegap maintains this Whitelist though. Will re-post if I find anything.

  18. Naga says:

    Hi anuj,
    Thanks for the post code .It was really very useful to my project. pls keep the post for valuable code.

  19. Steve Batcup says:

    Excellent thank you so much!

  20. Steve says:

    Dude, Thanks. I couldn’t find this shit anywhere. It’s been brutal, but this was the happy final hurdle to an otherwise lengthy night due to shitty ass documentation.

  21. Rishabh says:

    Thank Buddy…..!!
    It was really very useful & works fine…
    Happy Coding.

  22. Yves Laurent says:

    Hi, thks it’s very helpful :)

  23. [...] (海外) PhoneGap Gotcha : ERROR whitelist rejection [...]

  24. Misfiring says:

    You just saved my day. Thanks!

  25. Ben says:

    Thanks for documenting this!

  26. Nils says:

    I ended up adding it to the cordova.plist as I could not find a phonegap.plist and it worked just fine.

  27. yves says:

    Thanks +1

  28. Cesar says:

    Hi people…WHERE THE HELL IS THAT PLIST FILE???

  29. Joseka says:

    Hi ALL, I don’t understand which external domain should I inform. The app is running locally…it’s not hosted. Should I inform “*.google.com”, so the app can access maps.google.com ?
    TIA !

  30. ravi says:

    thanks a lot

  31. prabu says:

    thank you

Leave a Reply

© 2011 Anuj Gakhar
%d bloggers like this: