本文介绍了在VS2013和更高版本的多设备混合应用程序中为facebookConnect指定app_id和app_name. W8.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在这个头上撞了一段时间了.

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

在Visual Studio 2013的多设备混合应用程序中尝试使用facebookConnect插件时,如何指定app_id和app_name?

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?

如果我使用CLI方法创建新的解决方案;类似于:

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

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

我可能可以使用CLI使用类似于以下命令的命令添加插件:(未经测试,该命令可能会略有错误)

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

但是...

直接在Visual Studio中创建Mutli-Device Hybrid应用程序时,如何添加它?

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:

方法1:

  1. 创建一个插件"目录
  2. 从以下位置下载代码 https://github.com/Wizcorp/phonegap-facebook-plugin 并提取到插件目录
  3. 编译/构建
  1. Create a "plugin" directory
  2. Download the code fromhttps://github.com/Wizcorp/phonegap-facebook-plugin and extract intothe plugin directory
  3. Compile/build

这似乎起作用",但随后被炸开:

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

Variable(s) missing: APP_ID, APP_NAME

方法2:

  1. 打开config.xml文件
  2. 添加以下"vs:feature"标签:
  3. 编译/构建
  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???

我有可用的值.

我似乎无法使用CLI将此插件安装到我的解决方案中,因为出现以下错误:

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 ,因为它可为配置插件提供更大的灵活性.话虽如此,您遇到的是与FacebookConnect插件一起常见的 issue 手动添加而不是使用cordova CLI时.要添加应用程序ID和应用程序名称,请按照已记录的此处.

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.

plugin.xml中,找到以下行<preference name="APP_ID"><preference name="APP_NAME">并将其修改为<param name="APP_ID" value="<id of your app>" /><param name="APP_NAME" value="<name of your app>" />

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>" />

这将使您克服错误.

但是,该插件是用Java编写的,并且未对参考进行预编译.因此,您将遇到未找到com.facebook.blah之类的问题.要克服这些其他编译问题,请遵循此处,这样您就可以构建插件依赖项而不会出现日食.

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.

要使用CLI安装插件,您需要从创建Cordova项目的<projectRoot>\bld\debug\platform\<yourplatform>运行命令.

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.

这篇关于在VS2013和更高版本的多设备混合应用程序中为facebookConnect指定app_id和app_name. W8.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 00:19