简体   繁体   中英

twitter login on phone gap android using cordova

I am trying to login with Twitter on Android using Cordova/PhoneGap. I haved used this example :

TwitterConnect.login(   function(result) {
  console.log('Successful login!');
  console.log(result);
}, function(error) {
  console.log('Error logging in');
  console.log(error);
} );

It throws the following error: uncaught type error: cannot call method 'login' of undefined .

The error tells you that TwitterConnect is undefined . One of the following reasons could be your case:

  1. You did not install the plugin, add the plugin with cordova plugin add twitter-connect-plugin
  2. You did not test on a real device, since this plugin only has android and ios support, you can't test in a browser. Run the app on a device with:
    • cordova run android
    • cordova run ios

您应该确保将Fabric API密钥放入

cordova plugin add twitter-connect-plugin --variable FABRIC_KEY=<Fabric API Key>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM