简体   繁体   English

Phonegap建立Facebook登录

[英]Phonegap Build Facebook Login

I have in an app for Android/iOS with a plugin "com.phonegap.plugins.facebookconnect" to login with Facebook. 我在适用于Android / iOS的应用程序中使用插件“ com.phonegap.plugins.facebookconnect”可登录Facebook。 It's not working anymore so I thought I should have to change it for another one, anyway it won't compile anymore case Phonegape Build has got rid of their Repository. 它不再工作了,所以我认为我必须将其更改为另一版本,否则如果Phonegape Build摆脱了他们的存储库,它将不再可以编译。 Problem is that any plugin I try that is in https://cordova.apache.org/plugins/ ... Throw the same error message when trying to compile: 问题是我尝试使用的任何插件都位于https://cordova.apache.org/plugins/ ...尝试编译时抛出相同的错误消息:

Error - One of your plugins requires a parameter - You can fix this here 错误-您的一个插件需要一个参数-您可以在此处解决此问题

I tried: 我试过了:

cordova-plugin-facebook
cordova-plugin-facebook4
xenious-cordova-plugin-facebook4
cordova-plugin-facebook-account-kit
etc ..

And I defined them in config.xml in all different ways possible: 我以各种可能的方式在config.xml中定义了它们:

<plugin name="plugin-name" source="npm" >
    <param name="APP_ID" value="123456" />
    <param name="APP_NAME " value="name" />
<plugin> 

<plugin name="plugin-name" source="npm" >
    <params>
        <param name="APP_ID" value="123456" />
        <param name="APP_NAME " value="name" />
    </params>
<plugin> 

<plugin name="plugin-name" source="npm" >
    <variable name="APP_ID" value="123456" />
    <variable name="APP_NAME " value="name" />
<plugin> 
  • APP_ID for some of the plugins is FACEBOOK_APP_ID and another one has one more value: AK_TOKEN. 一些插件的APP_ID为FACEBOOK_APP_ID,另一个插件的另一个价值为:AK_TOKEN。 Just put examples of how I define them in config.xml 只需将有关如何定义它们的示例放在config.xml中

Funny is that if I don't put anything just the plugin without parameters, the message is different: 有趣的是,如果我不只是放置没有参数的插件,消息就会有所不同:

Error - One of your plugins requires a parameter: APP_ID, APP_NAME, AK_TOKEN - You can fix this here 错误-您的其中一个插件需要一个参数:APP_ID,APP_NAME,AK_TOKEN-您可以在此处修复此问题

I made a new "Hello world" app without any plugin but this one and it is the same. 我制作了一个新的“ Hello world”应用程序,没有任何插件,但是这个和它是一样的。 I'm running out of ideas. 我的想法不多了。 Do I have to define those parameters somewhere else? 我是否必须在其他地方定义这些参数? Didn't use to be that way with the previous plugin I had. 我以前的插件以前不是那样的。 Any help? 有什么帮助吗?

You must set the parameters as follows: 您必须按如下所示设置参数:

<plugin name="cordova-plugin-facebook4">
    <params>
       <param name="APP_ID" value="XXXXXXX" />
       <param name="APP_NAME" value="XXXXXXX" />
    </params>
 </plugin>

preference set in config.xml config.xml中设置的首选项

<preference name="android-minSdkVersion" value="15" />

hope this helps. 希望这可以帮助。

I could finally make it work. 我终于可以使它工作了。

<plugin name="cordova-plugin-facebook4" source="npm" spec="1.7.4">
        <param name="APP_ID" value="XXXXXXX" />
        <param name="APP_NAME" value="XXXXXXXX" />
</plugin>

The difference was the spec"1.7.4" ... 区别在于规格“ 1.7.4” ...

After that, the build sent me a message that I had to define the android-minSdkVersion at the minimum necessary for the plugin, by default 14 if not stated. 之后,该构建向我发送了一条消息,我必须在插件所需的最低限度内定义android-minSdkVersion,如果未声明,则默认为14。 So placed this line also in config.xml 所以这行也放在config.xml中

<preference name="android-minSdkVersion" value="15" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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