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

半城伤御伤魂 提交于 2019-12-03 15:33:38

问题


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?


回答1:


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`



回答2:


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)




回答3:


Use <framework src="libs/ios/mylib.framework" />.



来源:https://stackoverflow.com/questions/18653413/how-to-copy-a-custom-ios-framework-using-plugin-xml-on-phonegap-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!