Phonegap Android Facebook插件publish_stream权限请求抛出“NPObject上的错误调用方法” [英] Phonegap Android Facebook plugin publish_stream permission request throws "Error calling method on NPObject"

查看:236
本文介绍了Phonegap Android Facebook插件publish_stream权限请求抛出“NPObject上的错误调用方法”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PhoneGap for Android,我刚刚集成了Facebook插件( https:// github .com / phonegap / phonegap-facebook-plugin )到我的项目。我需要获得可以发送到服务器的AccessToken,以便服务器可以以用户身份发布。当我第一次调用FB.login(回调,{scope:'email,user_birthday,user_location'})的时候,一切都是这样的,



工作正常和花花公子。但是如果我添加'publish_stream'权限到范围我得到一个错误:未捕获错误:在NPObject上调用方法。错误是源自线路863上的cordova.js(phonegap 2.8),它是:
var messages = nativeApiProvider.get()。exec(service,action,callbackId,argsJson);
我以下一个方式初始化插件:

  FB.init({
appId:Global。 Facebook.apiKey,
nativeInterface:CDV.FB,
useCachedDialogs:false,
});

如果我从范围中删除该权限,所有的工作都可以。也许任何人有一些经验或想法如何解决这个问题?我在手机上调试我的应用程序(Samsung Galaxy S2通过USB调试功能连接),IDE使用adt-bundle的Android开发工具(basic eclipse);



提前。

解决方案

我似乎已经得到了问题的根源。最初登录时,我不能要求写(发布)权限。据了解,我必须在初次登录后才能要求他们。这对我来说是不舒服的,因为我可能不得不在单个用例中提示用户多次许可,这是不好的。也许我错过了一些文档页面,其中所有的内容都已经提到了?


I'm using Phonegap for Android and I have just integrated Facebook plugin(https://github.com/phonegap/phonegap-facebook-plugin) to my project. I need to get an AccessToken that could be sent to server so that server could post on user's behalf.


When I at first called FB.login(callback, {scope:'email,user_birthday,user_location'}) everything works fine and dandy. But if I add 'publish_stream' permission to the scope I get an error: "Uncaught Error: Error calling method on NPObject". Error is originating from cordova.js (phonegap 2.8) on line 863 which is: var messages = nativeApiProvider.get().exec(service, action, callbackId, argsJson); I initialize the plugin in the next manner:

        FB.init({
            appId: Global.Facebook.apiKey,
            nativeInterface: CDV.FB,
            useCachedDialogs: false,           
        });

If I remove that permission from scope all works ok. Perhaps anyone has some experience or thoughts on how to fix such issue? I debug my app on my phone (Samsung Galaxy S2 connected via USB debugging feature) and for IDE I use adt-bundle's Android Developer Tools (basicly eclipse);

Many thanks in advance.

解决方案

I seem to have gotten to the root of the problem. When logging in initially, I can't ask for write ("publish") permissions. As I understand I must ask them later after initial login. Which is abit uncomfortable for me, since I might have to prompt user for permissions several times during a single use-case which is bad. Perhaps I am missing some documentation page where all that stuff is already mentioned?

这篇关于Phonegap Android Facebook插件publish_stream权限请求抛出“NPObject上的错误调用方法”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆