Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy a custom ios framework using plugin.xml on Phonegap 3

I am currently making a plugin for phonegap 3. I have a custom framework to copy using the source-file directive. In the plugin.xml I tried:

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

but I get the error when I add the plugin to my project:

mylib.framework is a directory (not copied)

I tried to copy the framework file by file but it is going in the wrong directory.

How can I copy a custom ios framework using the plugin.xml file?

like image 849
poiuytrez Avatar asked Sep 06 '13 08:09

poiuytrez


2 Answers

You can copy the binary file (who should be in "mylib.framework/Versions/A/") and the headers ( ".h" who should be in "mylib.framwork/Versions/A/Headers")

like this

<source-file src="libs/ios/mylib.framework/Versions/A/mylibBinary" framework="true" />
<header-file src="libs/ios/mylib.framework/Version/A/Headers/mylibHeader.h" />
...

You also have to add the dependencies manually, IE.: this framework needs the iOS AVFoundation.framework so, you need to add this too.

<framework src="AVFoundation.framework" />

One more thing you have to know, if you want to submit this plugin to PhoneGap.

Plugin Submission Guidelines

Any application that contains binary libraries will be rejected. This is because we need to be able to see exactly what is in a plugin as part of our code review process. So when submitting a plugin make sure that it doesn’t contain binary libraries. (PhoneGap)

like image 35
Icaro Martins Avatar answered Nov 10 '22 13:11

Icaro Martins


Good news: it seems that the Cordova folks are working on this as we speak. There is a feature request as well as a commit to GitHub that claims to resolve this issue. The framework tag will support the custom="true" attribute. For example, here's how you could do it for the AWS iOS SDK Runtime framework:

<framework src="src/ios/Frameworks/AWSRuntime.framework" custom="true" />

UPDATE: It seems that this change made it into the current stable release of Cordova on 11/29/2013 (two days ago). Just update your Cordova and Plugman binaries and you should be good to go.

$ npm update -g cordova  # if using `cordova plugin add xyz`
$ npm update -g plugman  # if using `plugman install --platform x --project y --plugin z`
like image 153
sffc Avatar answered Nov 10 '22 14:11

sffc