phonegap oauth插件无法加载

时间:2014-04-15 21:21:06

标签: ios cordova

我测试手机间隙oauthio插件但无法让它工作

跟随文档。

使用命令行添加了插件 并且还安装了inappbrowser

还将此添加到我的config.xml

<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="com.phonegap.plugins.oauthio" />

inappbrowser它的加载和工作。 但OAUTH不是。 我在这里和那里添加了一些警报() 但是当我添加一个警告来显示OAUTH的内容时,它就不会发生

alert('device ready'); //to see if the device is ready, no problems here
alert(window.open); //to see if inbrowserapp is loaded, no problems here
alert(OAuth);// no message. looks like is not defined,also tried alert(OAuth.initialize) same luck
OAuth.initialize("VeQmyEu0QtzIOO9WjM1IlAU0ty4");
alert('postinit');

在插件中,定义说&#34; OAuth&#34;所以名称还可以,我安装的插件是

oauthio-test % phonegap plugin list
[phonegap] com.phonegap.plugins.oauthio
[phonegap] org.apache.cordova.inappbrowser

我还删除了&#34; platform / ios&#34;的内容。防止文件缓存

我的访问权是这些

<access origin="*" />
<access origin="http://127.0.0.1*"/> <!-- allow local pages -->
<access origin="*graph.facebook.com*" />
<access origin="*api.twitter.com*" />
<access origin="*github.com*" />
到目前为止没有运气。 它就像我在IE6中发布时的毛毡一样

编辑: 添加了完整的代码,该代码显示了事件中的im&#39; ondeviceready&#39;

 $(document).on('deviceready', function() {
    alert('device ready');//shows ok
    alert(window.open); //shows ok
    alert(OAuth.OAuth.initialize);//it dies here
            OAuth.initialize("VeQmyEu0QtzIOO9WjM1IlAU0ty4");
    alert('postinit');//this alert won't displayed
            $('#fb-connect').on('click', function() {
                $('#result').html("");
                OAuth.popup("facebook", function(e,r) {
                    if (e)
                        $('#result').html('error: ' + e.message);
                    else
                        // the access_token is available via r.access_token
                        // but the http functions automagically wrap the jquery calls
                        r.get('/me').done(function(data) {
                            $('#result').html("facebook: Hello, " + data.name + " !");
                        });
                });
            });

2 个答案:

答案 0 :(得分:2)

在终端中,您需要通过此网址并输入

&#34; phonegap插件添加https://github.com/oauth-io/oauth-phonegap &#34;。

您可以使用Android或iOS模拟器来运行该应用程序。

答案 1 :(得分:0)

确定。所以看起来这是一个电话缺口错误。

如果您稍后添加插件,则需要清理平台和插件/ * .json文件

我按照这篇文章发布并正确安装了插件

Phonegap 3.0 IOS plugins not found

相关问题