Adding Third Party SDK's to Capacitor Plugin

Hi,

I am trying to generate a Capacitor Plugin that includes a third party’s SDK. I have created the plugin and got it working fine on the app.

I have copied the files of the SDK into the PODs folder. Import into my Podfile and run pod install which successfully installed the SDK.

I then dragged the .framework file of the SDK into the Frameworks and Libraries on the Plugin.

When i then go to App to try and compile it onto the simulator it can’t find the module.

Can anyone give a workflow process that i could follow in order to add a third party library to a capacitor plugin or advised what i may be missing

Thanks and hopefully someone can shed some light on it for me

Capacitor plugins are CocoaPods libraries, so you have to add the framework in the podspec as you would do on a CocoaPods library.
In this case you need the vendored_frameworks property.
You should copy the .framework to the plugin folder, not inside Xcode, then adjust the patch and run npx cap update ios

HI

Thanks for the info. I got this working a couple of weeks ago and just tried to replicate to another project but it isn’t working. I am missing a step here i think.

I added the framework to the podspec of the plugin. The podspec of the framework has 4 dependencies (set with s.dependency). If i then run ionic cap sync or npx cap update ios it seems to complete the process that includes doing a pod install and it says it has included the dependencies.

The problems is when i open in ios and attempt the build to the simulator it can’t find the dependencys from the framework’s podspec. If i look in directory of /Users/my_name/Library/Developer/Xcode/DerivedData/APP_ID/Build/Products/Debug-iphonesimulator/LIB_NAME i can see the library but on the new project in the directory for the new project i can’t see the same.

What does it take to get it to get the dependency libraries from the plugin’s podspec into the directory.

I am missing a command but i can’t think what it was

Cheers

James

Are you trying to build a Capacitor app with the plugin installed or the native project of the plugin?

If it’s a Capacitor app with the plugin installed it should just work, as long as you only try to use the dependencies in the plugin classes, the dependencies in the podspec are only available for your plugin, not for the Capacitor app.

If it’s the native project of the plugin, then you also have to add the dependencies in the Podfile and run pod install inside ios folder.