简体   繁体   English

iOS Cordova 第一个插件 - plugin.xml 注入一个特性

[英]iOS Cordova first plugin - plugin.xml to inject a feature

I'm creating my first Cordova plugin and I'm confused to the structure of building it.我正在创建我的第一个 Cordova 插件,但我对构建它的结构感到困惑。 I have a fresh Cordova project and I've added the iOS platform.我有一个新的 Cordova 项目,并且添加了 iOS 平台。 I was looking at this for guidance (specifically the Echo iOS plugin example part):我正在寻找指导(特别是Echo iOS plugin example部分):

https://cordova.apache.org/docs/en/5.1.1/guide/platforms/ios/plugin.html https://cordova.apache.org/docs/en/5.1.1/guide/platforms/ios/plugin.html

but I'm quite new to this and I'm a little bamboozled by what I'm actually supposed to be doing.但我对此很陌生,我对我实际应该做的事情有点困惑。 It tells me to use plugin.xml to inject a feature specification to the local platform's config.xml file.它告诉我使用 plugin.xml 将特性规范注入本地平台的 config.xml 文件。 Is the plugin.xml a file I need to create or is it the one in project> plugins> cordova-plugin-whitelist > plugin.xml ? plugin.xml 是我需要创建的文件还是project> plugins> cordova-plugin-whitelist > plugin.xml Either way how do I use it to inject this feature?无论哪种方式,我如何使用它来注入此功能? I presume it's something it reads from when it builds the project but I'm still unsure how to do it.我认为这是它在构建项目时读取的内容,但我仍然不确定如何去做。

Thanks.谢谢。

As far as i know to create custom plugins, you gotta create a plugin folder as per the specifications and ensure that the plugin is referred in the fetch.json file under plugins folder.据我所知,要创建自定义插件,您必须根据规范创建一个插件文件夹,并确保在 plugins 文件夹下的 fetch.json 文件中引用该插件。 Then removing and re-adding the platform should take care of plugin installation in respective folder.然后删除并重新添加平台应该负责相应文件夹中的插件安装。 You can refer any of the existing plugins to replicate the same folder structure.您可以参考任何现有插件来复制相同的文件夹结构。

The detailed info on custom plugin creation is available in cordova official documentation .Hope it helps关于自定义插件创建的详细信息可在cordova官方文档中找到。希望它有所帮助

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

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