How to bundle CocoaPods dependencies with Cordova Plugin? How to bundle CocoaPods dependencies with Cordova Plugin? ios ios

How to bundle CocoaPods dependencies with Cordova Plugin?


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.

Detailed information is here:https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html

Simply add something like:

<platform name="ios">    ...Other iOS platform specific declerations...    <framework src="OpenSSL" type="podspec" spec="~> 1.0.0" /></platform>

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.


I couldn't find a good solution to this problem so I created a plugin for it, https://github.com/blakgeek/cordova-plugin-cocoapod-support. It adds support for defining Cocoapod dependencies in the plugin.xml. It should be included as a dependency of another plugin and then that plugin can add entries in the ios platform section of the plugin.xml. It supports all of the pod dependency specifications like git repo, configurations, subspecs, etc. Hope this helps someone out.


I couldn't find much info about this either, so I wrote a Cocoapods plugin to help: https://github.com/xdissent/cocoapods-cordova It manages your plugin.xml automatically and builds a universal static library which links in only non-cordova dependencies. Currently a WIP, but I'm using it successfully on a few plugins.