phonegap build - facebookConnectPlugin not defined

寵の児 提交于 2019-12-11 02:18:23

问题


I am trying to install a facebook integration in the simplest way with phonegap build.

Did the following:

  1. added this to config.xml:

<gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.9.0">
  	  <param name="APP_ID" value="****************" />
   	  <param name="APP_NAME" value="******" />
	</gap:plugin>
  1. made sure the plugin appears on installed plugins on phonegap build:
    it appears as it should.
    Plugin Source Version Latest Platforms
    com.phonegap.plugins.facebookconnect pgb 0.9.0 0.9.0 android,ios

those two steps are all I should have done according to documentation: https://github.com/Wizcorp/phonegap-facebook-plugin/blob/master/platforms/pg-build/README.md

but when I try to use the plugin I get "ReferenceError: facebookConnectPlugin is not defined"

Did I miss anything? Anyone else encountered this situation?

thanks.


回答1:


I haven't had a chance to try this yet, but this version ("0.9.0") was released last year in November. It is currently up to version 0.12.0. You can either specify this version or omit it to use this particular version, but for the sake of its recommendation, I am going to stick with trying 0.9.0 for now.

If you inspect this repository, look to the folder:

./www/phonegap/plugin/facebookConnectPlugin/

So tonight I"ll be trying to include the <script> for the facebookConnectPlugin.js. Looking to the source, it appears to have the dependency of the Facebook JS file, so prepare your head to include that first.

Let me know if you try this and if it succeeds or fails before I try it tonight. Good luck!




回答2:


@joel234,
Okay. First thing. The solution I am going to post is for Phonegap Build, the solution does not apply to Cordova, per se.

For the last several weeks, i've been posting this again and again, the plugin com.phonegap.plugins.facebookconnect is deprecated, as in obsolete. This means you *should* not use it. You should use a much more up to date version.

In addition, it appears you are not following the blogs. Otherwise you'd know that you should be using source=npm AND the names with periods in it have also be deprecated.

You can read the detail here: Facebook connect plugin is not working (...)

Your new plugin setting is:

<gap:plugin name="cordova-plugin-facebookconnect-orlando" source="npm" version="0.11.0">

In addition, I strongly suggest you read the bold sentences in the following.

Top Mistakes by Developers new to Cordova/Phonegap

If this works, as expected, Can you tell me where you found this example, so I can speak to the author and have it corrected. TIA - Best of Luck



来源:https://stackoverflow.com/questions/31215255/phonegap-build-facebookconnectplugin-not-defined

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