Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Add a Third Party Framework to a Cordova 3.0 Custom Plugin?

I'm trying to create a cordova plugin with a third party framework (in this case AdColony.framework) https://github.com/AdColony/AdColony-iOS-SDK. I'm having trouble figuring out how to add this framework using the plugin.xml (Plugin Specification).

I tried to include the file as a framework through

<framework src="src/ios/libs/AdColony.framework" />

OR

<source-file src="src/ios/libs/AdColony.framework" framework="true" />

But both didn't worked. Please help me to figure this out. Any suggestions and response will be greatly appreciated. Thanks.

like image 661
sharic19 Avatar asked Nov 06 '13 03:11

sharic19


People also ask

Where is plugin XML in Cordova?

The plugin element is the plugin manifest's top-level element. The plugin namespace, http://apache.org/cordova/ns/plugins/1.0 . If the document contains XML from other namespaces, such as tags to be added to the AndroidManifest. xml file in the case of Android, those namespaces should also be included in the element.


2 Answers

Custom frameworks work with Cordova 3.4

<framework src="relative/path/to/my.framework" custom="true" />

like image 194
doncoleman Avatar answered Oct 12 '22 01:10

doncoleman


This answer suggests it is not possible: How to copy a custom ios framework using plugin.xml on Phonegap 3 which suggests converting the framework into a static library and using that.

This thread might be useful to you: http://osdir.com/ml/phonegap/2013-11/msg00176.html

And you might want to follow along with this bug: https://issues.apache.org/jira/browse/CB-5238 , which appears to address what you want and was recently merged (so might make it into 3.2 or 3.3). It also has a workaround:

1. a <resource-file> tag to copy the .framework folder and include in Xcode
2. a <framework> tag to add it to the "Link Binary with Libraries" section of the Build Phases of the project

(You can include default frameworks with the framework tag (of course, that is not what you are asking).)

like image 23
mooreds Avatar answered Oct 12 '22 01:10

mooreds