Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Error calling method on NPObject. #316

Closed
gihan9a opened this issue Jul 10, 2013 · 10 comments
Closed

Error: Error calling method on NPObject. #316

gihan9a opened this issue Jul 10, 2013 · 10 comments

Comments

@gihan9a
Copy link

gihan9a commented Jul 10, 2013

I'm using cordova 2.8 with facebook-android-sdk-3.01
When I call FB.login(null, {scope: 'email,user_birthday,read_stream,publish_stream,offline_access'}); It throws following error in logcat for my app

Error: Error calling method on NPObject.
at Object.androidExec as exec
at Object.login (file:///android_asset/www/lib/cdv-plugin-fb-connect.js:29:17)
at Object.ui (file:///android_asset/www/lib/facebook_js_sdk.js:5118:37)
at Object.login (file:///android_asset/www/lib/facebook_js_sdk.js:6150:8)

In addition, the "Cordova Facebook Connect plugin initialized successfully." message from cdv-plugin-fb-connect.js file or error alert message doesn't appear.

I tried with cordova 2.5 for sample Hackbook app and it works fine.
For cordova 2.8 it keeps showing "Loading Hackbook" message but no errors or "Cordova Facebook Connect plugin initialized successfully" message prints on logcat.

I checked #303 issue also wich seems close to this issue. But it's not the reason.

So I think this may be a bug for cordova 2.8.
Any help to resolve this issue appreciate.

@JLNNN
Copy link

JLNNN commented Jul 10, 2013

Try using asking for {scope: "email"} only, that should help with first login.

@gihan9a
Copy link
Author

gihan9a commented Jul 10, 2013

Thanks @JLNNN For your fast response. Yes it really worked 👍 But not all :( as expected.

Now it shows "Cordova Facebook Connect plugin initialized successfully" and login prompt appears. But callback is not firing.

        FB.login(function(){
            alert('FACEBOOK LOGIN SUCCESS');
        }, {scope: 'email'});

I can see api call results in logcat warning with following messages,
Attempted to send a second callback for ID: org.apache.cordova.facebook.Connect816566657
Result was: {"authResponse":{"accessToken":"CAABeQgmrWg0BAPgg6SEUeIC5DpP3lulzQjL...................

I've set up the package name, class name (com.facebook.LoginActivity) key hashes and enabled the login

Found similar issues without correct answer,
#308
#313

@JLNNN
Copy link

JLNNN commented Jul 11, 2013

I think it's a bug in the plugin. You can get the email scope, but not ask for publish_actions, because if you try that after asking for the email address, you'll get that "Attempted to send a second callback" message. I tried {scope: 'email,publish_actions'} on iOS and it's working fine. If you do that on Android, you'll get an NPObject-error.
Can anyone confirm this?

@ajito
Copy link

ajito commented Jul 11, 2013

I have a very similar issue: http://stackoverflow.com/questions/17580796/phonegap-facebook-plugin-error-calling-method-on-npobject

I got it yesterday after updating to android SDK tools 22, everything was fine before. The login process results in an NPObject error. The error occurs even with the hackbook demo provided by the author of the plugin.

@fanals
Copy link

fanals commented Jul 12, 2013

I tried #307 which says it works if you use your app in release mode (right click on project -> android tools -> export as sign app). It didn't do the trick for me and yes I changed in facebook settings with the result of keytool -exportcert -alias release -keystore releasekey.keystore | openssl sha1 -binary | openssl base64

Does it work for you ?

And #312 seems to have the same problem.

@Roberto-A-Ferro
Copy link

Any fixes to this problem? I have the exact same problem as issue #312 I've used Cordova 2.3.0, 2.5.0 and 2.7.0. I don't get any "Cordova Facebook Connect plugin initialized successfully" messages and when I click on the Login button on the Simple Example it asks me to given my Facebook App access to my info but this does nothing i.e. Facebook itself isn't updated with the app and probably hence why the callback isn't firing? Please any help would be appreciated!!

@JLNNN
Copy link

JLNNN commented Aug 13, 2013

I just updated my iOS and Android projects with the latest Facebook SDK and the latest PhoneGap Facebook plugin and it seems to work now. No more errors and I get two requests when I login. One for accessing email, public timeline and friendslist and one for publishing actions. NICE!

@avivais
Copy link

avivais commented Aug 20, 2013

Do you use the latest fb plugin with phonegap 3.0?

@JLNNN
Copy link

JLNNN commented Sep 12, 2013

No, I'm using PhoneGap 2.9.0 since I think 3.0 is not supported yet.

@aogilvie
Copy link
Collaborator

Closing. Out-of-date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants