VS-MDA: Custom iOS-Framework in Plugin

2019-09-04 06:59发布

问题:

we want to create a MobFox-Plugin for our hybrid apps. It is already running well in CLI-Cordova Apps, but it does not work in our hybrid apps, because it seems that the directory structure of the framework (the symbolic links between headers and version directory) is destroyed by Windows, where the framework is inside the plugin in the mda project. If I start a build, the header directory of is not recognized as a symbolic link, but as an ordinary executable textfile on the Mac.

This is how I include the framework in the plugin xml:

<framework src="libs/ios/MobFox.framework" custom="true"/>

I also tried to copy the MobFox.framework to the SDK Frameworks Folder and reference it like the standard system libraries (which work well):

<framework src="MobFox.framework" />

But this also fails, though the Framework is now included correctly in Xcode. But the compiler now says that it cannot find the MobFox.h-class, this is how it's included:

#import <MobFox/MobFox.h>

So I really think that the problem is that Windows cannot handle the symbolic links inside the .framework File. Does anybody has a workaround or solution for this problem? Or an idea why my Workaround with placing the file in the Standard-Frameworks Folder does not work?

Any help would be highly appreciated.

Thanks

回答1:

Same problem here - it appears that when the plugin is published to the cordova registry it loses the symbolic links inside the .Framework package that tell XCode where everything is.

They are maintained on git, so it is something in the plugman export/publish that is going wrong.

So for example

cordova plugin add https://github.com/uxcam/cordova-uxcam

will work for the plugin I am writing, but not

cordova plugin add com.uxcam.cordova.plugin

which is the published version.

If you delve down into the 'plugins' folder of the project you added it too and 'show package contents' on the com.uxcam.cordova.plugin file you can then get into 'src/ios'UXCam.framework' and see how it has messed up the symbolic links in the framework folder that should point at the Headers folder and a link the the library binary as well.

Reference: Cordova bug report here: https://issues.apache.org/jira/browse/CB-6092

Update: I've worked around the problem by manually putting files in the framework into the places they need to be. So now on the github project I reference above you can see that the framework library is directly in the UXCam.framework folder, and there is an explicit Headers folder that has the UXCam.h file in it. This works for a published plugin now.

Not an ideal solution and every time I update the framework I'll have to fix the layout again, but works for now until I can find the proper place to report the problem.