1

I am trying to integrate filepicker.io with my Phonegap 2.2.0 project on iOS6 for iPad. In the docs on filepicker.io they say, just get childbrowser running and you are set. ( https://github.com/Filepicker/filepicker-phonegap ) Well, I got child browser running and tested the typical google example. But when I try to call the api like in their android example, it doesn't work. I edited the whitelist as well because of errors. The question is: Did somebody ever tried it on iOS? There are no examples to be found. Thanks in advance.

1 Answers1

2

To get it running on iOS with their new V1 API, you need to create your own filepicker string manually and open in directly in the childbrowser and at the end of the string you need to append a redirect url. Here is how you do it for photos:

pick: function() {
    cb = window.plugins.childBrowser;
    if(cb!=null){
        cb.onLocationChange = function(loc){
            if (loc != "about:blank"){
                console.log(loc);
                if(loc.indexOf("fpurl") > -1) {
                cb.close();
                }
            var n = loc.split("fpurl=");
            fpurl = n[1];
            alert(fpurl);
        }
    };
cb.showWebPage("https://www.filepicker.io/dialog/open/?m=image/*&key="YOURAPIKEY"&referrer=&modal=false&redirect_url=https://www.filepicker.io/dialog/phonegap_done/");
}
albertut
  • 64
  • 7
  • Ah, so this gets me the S3 url of the file the person picks and then I can use filepicker.read to get the file contents, once childbrowser is closed. Very helpful, thanks. By the way, I found showWebPage would not work until I did an encodeURI() on the url. – Martin D Feb 17 '13 at 18:45
  • Helpful posting! Straight to the point. Created github issue for that: https://github.com/Filepicker/filepicker-phonegap/issues/1 – Mars Robertson Apr 05 '13 at 21:19