Specifying app_id and app_name for facebookConnect in a multi-device hybrid app in VS2013 & W8.1

喜夏-厌秋 提交于 2019-12-02 16:30:03

问题


I've been banging my head on this one for a while now.

How do I specify the app_id and app_name when trying to use the facebookConnect plugin in a Multi-Device Hybrid app in Visual Studio 2013?

If I create a new solution using the CLI approach; something similar to:

cordova create MyTest <blah> <blah> <blah>

I can probably use the CLI to add the plugin with a command similar to: (Untested and the command might be slightly wrong)

cordova plugin add com.phonegap.plugins.facebookconnect

BUT...

How do I add it when I've created a Mutli-Device Hybrid app directly from within Visual Studio?

I've tried 2 approaches to get this to install:

Method 1:

  1. Create a "plugin" directory
  2. Download the code from https://github.com/Wizcorp/phonegap-facebook-plugin and extract into the plugin directory
  3. Compile/build

This seems to "work" but then bombs out with:

Variable(s) missing: APP_ID, APP_NAME

Method 2:

  1. Open the config.xml file
  2. Add in the following "vs:feature" tag:
  3. Compile/build
    <vs:features>
     <vs:feature>com.phonegap.plugins.facebookconnect</vs:feature>
    

This method also seems to "work", showing a line in the build Output window:
Calling plugman.fetch on plugin "com.phonegap.plugins.facebookconnect"

But then it too bombs out with the ever annoying:

Variable(s) missing: APP_ID, APP_NAME

Can someone PLEASE tell me where to add these two variables in so that the thing builds???

I have the values available.

I can't seem to use the CLI to install this plugin into my solution because I get an error like:

Current working directory is not a Cordova-based project

Thanks for any help you can offer.


回答1:


I'd recommend going with method 1 since it provides greater flexibility to configure your plugin. That being said, what you are running into is a common issue with the FacebookConnect plugin when it is added manually instead of using the cordova CLI. To add the app ID and app name, do the following as documented here.

In plugin.xml, find the below lines <preference name="APP_ID"> <preference name="APP_NAME"> and modify them to <param name="APP_ID" value="<id of your app>" /> <param name="APP_NAME" value="<name of your app>" />

This will get you past the error.

However, the plugin is written in Java and the references are not precompiled. So, you will run into issues like com.facebook.blah not found. To get past these additional compilation issues, follow the instructions here, which let you build the plugin dependencies without eclipse.

To use the CLI to install the plugin, you need to run the commands from <projectRoot>\bld\debug\platform\<yourplatform> where the cordova projects are created.




回答2:


What you probably miss is the renaming of the element from preference to param

in plugin.xml change preference to param for app name and app id an also enter their value.

<preference name="APP_NAME"> 
to 
<param name="APP_NAME" value="<name of your app>" />


来源:https://stackoverflow.com/questions/25516444/specifying-app-id-and-app-name-for-facebookconnect-in-a-multi-device-hybrid-app

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