问题
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:
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/");
}
来源:https://stackoverflow.com/questions/13369249/filepicker-io-with-phone-gap-on-ios