filepicker.io with phone gap on IOS

吃可爱长大的小学妹 提交于 2019-12-24 07:37:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!