问题描述
我正在开发一个Cordova插件,而对于iOS平台,我想要合并一些现有的(非Cordova特定的)Cocoapods。我无法找到有关如何使其工作的任何信息或示例,我希望这是一个相当常见的用例。
I'm developing a Cordova plugin, and for the iOS platform, I'd like to incorporate a few existing (non-cordova-specific) Cocoapods. I haven't been able to find any info or examples on how to get this working, and I would've expected this to be a fairly common use-case.
请注意,我并没有尝试将Cordova用作Cocoapod,其中有大量信息,而是使用我正在开发的Cordova插件的iOS平台内的Cocoapods。
Note that I am not trying to use Cordova as a Cocoapod, for which there is a decent amount of information out there, but rather use Cocoapods from within the iOS platform of a Cordova plugin that I'm developing.
Cordova的 plugin.xml
通常需要列出所有项目依赖项才能正确捆绑。有没有人知道内部使用Cocoapods的Cordova或PhoneGap插件?
Cordova's plugin.xml
generally needs to list all project dependencies to bundle things correctly. Does anyone know of a Cordova or PhoneGap plugin which internally uses Cocoapods?
推荐答案
我只是浪费了几个小时才这样我想我会把这个放在任何感兴趣的人身上。 Cordova从Cordova-CLI版本6.4.0 / Cordova iOS版本4.3.0支持与CocoaPods直接集成。
I just wasted several hours on this so I thought I would put this here for anyone who is interested. Cordova as of Cordova-CLI version 6.4.0/Cordova iOS version 4.3.0 supports direct integration with CocoaPods.
详细信息在这里:
只需添加以下内容:
<platform name="ios">
...Other iOS platform specific declerations...
<framework src="OpenSSL" type="podspec" spec="~> 1.0.0" />
</platform>
到插件的plugin.xml文件。 Cordova自动生成.xcworkspace。使用它而不是xcodeproj文件,你很高兴。
To the plugin.xml file for your plugin. Cordova automatically generates an .xcworkspace. Use that instead of the xcodeproj file and you are good to go.
这篇关于如何使用Cordova插件捆绑CocoaPods依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!