如何在 phonegap 中为 ios 添加插件?

How to add plugins for ios in phonegap?

我是 phonegap 新手。

我使用 phonegap 应用创建了新项目。

现在我喜欢在xcode(7.2.1)中使用这个项目可以吗?

在 phonegap 中为各种插件开发应用程序的最佳方法是什么,我在 google 上搜索并听说了 coredova,但无法理解确切需要。

对于 IOS 试试这个来添加任何新插件。

转到 Mac CLI 中的 Created Project Directory

Then do this.

If you haven't added IOS Platform then run below command.

cordova platform add ios

Then build your whole project with below command.

cordova prepare ios

Then to add plugin run below command.

cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

这里随便安装什么插件就可以了

确保您在安装插件时已连接到互联网。

Now I like to use this project in xCode (7.2.1) is it possible?*

是的,有可能,Read this article

What is the best way to develop app in phonegap for various plugin

我假设你问的是如何添加不同的插件?

  1. 使用 PhoneGap 接口创建您的应用程序(您已经这样做了)
  2. 转到您存储 PG 构建文件的 www 文件夹并查找您的 config.xml,然后您将看到一个已经存在一些插件的部分。您可以通过简单地复制和粘贴以下 XML 语法(电池状态插件)来添加其他的,例如:

    <plugin name="cordova-plugin-battery-status" spec="1.1.0" source="pgb" />

有关 PhoneGap 插件的完整列表,请参阅本文: https://build.phonegap.com/plugins

或者,您可以通过命令行界面添加它们(参见问题的第一个答案)