I have an Ionic/Capacitor mobile app that I am building for iOS. This app uses a custom Capacitor plugin that I have written. The custom plugin requires linking against a library/framework from a 3rd party vendor.
In order to get XCode to link the custom plugin against the 3rd party library, I must go into XCode settings for the project and add the 3rd party library/framework to the settings. If you are familiar with XCode, then this is done by clicking the “Pods” project to access the Pods project settings, choosing the TARGET of my custom plugin to access its settings, then choosing “General” tab, scrolling down to “Frameworks and Libraries” section and adding the 3rd party framework/library.
After the 3rd party framework/library is added to the XCode project settings, everything works perfectly. I can build my Ionic/Capacitor app (along with custom Capacitor plugin), then deploy it to my test iPhone device, and the app (and custom Capacitor plugin) works perfectly.
The problem appears when I need to make a change to the JavaScript Ionic web app code. After making any changes to the Ionic web app (and compiling with “ionic build” command), of course I must run “npx cap sync” to copy the new compiled web application to the XCode project. The “npx cap sync” command does what it’s supposed to do, EXCEPT that it has the nasty side-effect of overwriting the “project.pbxproj” file in the XCode project.
This is a huge problem because that file (project.pbxproj) contains the customized settings to link against the 3rd party library/framework that my custom plugin in needs. So, every time I run “npx cap sync”, I need to manually dig through the XCode settings to re-add the 3rd party library/framework that our custom plugin requires.
This is a giant hassle, and it seems like I shouldn’t need to do this. I did notice that if I run “npx cap copy” (instead of “npx cap sync”), then it doesn’t overwrite the “project.pbxproj” file. However, I’ve always used “npx cap sync” since it definitely copies everything I need.
Here is a video I made for our development team showing the bug and what needs to be done to work around it: https://valmarc.com/download/BP2_Capacitor_Xcode_bug_workaround.mp4
Is there any other solution for linking a custom plugin against a 3rd party library/framework in iOS?