Wednesday, March 7, 2012

Whitelist rejection error in Xcode for Sencha touch 2 and Phonegap

Hello,

If you have developed iPhone application using sencha touch 2 and phonegap and if your application is using Ajax request or JsonP request you might have above error. That's not the issue of cross domain because when you convert your sencha touch application to native app using phonegap, it loads index.html and other js files in browsers using file uris. Something like below

file://..
So there is no issue of cross domain. But still if you get above error. That's because of  iPhone security restriction. You must add your domain to whitelist. For that open the file phonegap.plist and you should see following.


See the external host. Here you have to add your domain something like below

TEST.MYDOAMIN.COM
Make sure that you don't add http or other protocols. Just a domain name and it should work.

7 comments:

  1. This would be really useful if i had a phonegap.plist file.

    ReplyDelete
    Replies
    1. They renamed it to cordova.plist.

      Delete
  2. I did this change and recompiled the build. but things are still same and its giving me error as whitelist rejection.

    Is their anything else I have to look at?

    ReplyDelete
  3. Try to put a * in order to accept every external server

    ReplyDelete
  4. I have added my URL under the external host - it works, but what happens is XCODE calls in the safari browser. I have embeded video into my app from youtube, I added *.youtube.com as an external host (I have also tried www.youtube.com) but when I view in simulation, the viewer just jumps to the embed video using safari browser. Has this happened to anyone else?

    ReplyDelete
    Replies
    1. You can set OpenAllWhitelistURLsInWebView to YES in your cordova.plist file and this will resolve an issue.

      Delete