EstimoteSDK - Cordova plug-in - CocoaPods


I would like to share my experience in creating a Cordova plug-in for web application and using the Estimote iOS SDK in it.

What is Apache Cordova?

Apache Cordova is a framework used in mobile development that allows you to write one code pool with web technologies (HTML, CSS, JavaScript) for multiple platforms (Android, iOS, Windows Phone, Ubuntu Phone, …).
An app’ based on a such framework is called a web app’.

What is a Cordova plug-in?

A Cordova plug-in is a package containing a JavaScript interface that allows you to call native methods with JavaScript functions.
Little scheme:
web (HTML, CSS, JavaScript) <--> plug-in <--> native methods (Java, Swift, ...)

At Lekooa team, we use this Cordova plug-in for ranging in our web application using the methods that Estimote provides.

At the beginning, we were copy/pasting the EstimoteSDK.framework file into our Cordova plug-in, but we faced problems with the integration during the cordova platform add ios command.

That’s why we searched for an easier way to use the Estimote SDK, as easy as it was done for Android.

And then we found the Estimote iOS SDK in the CocoaPods library.

What is CocoaPods?

CocoaPods is a dependency manager for iOS used to add third-party libraries into your code (like the Estimote SDK).

So we added that to our plug-in’s plugin.xml file following the Cordova documentation:

    <platform name="ios">
        <!-- To add a CocoaPod pod in a Cordova plug-in: -->
        <framework src="EstimoteSDK" type="podspec" spec="~> 4.17">

Unfortunately, it didn’t work. We lost lot of time but in the end, we managed to get it work just by writing the true version number: 4.17.0 (very frustrating :frowning:).

So if you want to add a third-party library to your Cordova plug-in, write the correct number :wink:

1 Like