How to create a dynamic framework (Swift) based on two static libraries using Cocoapods
I want to create a dynamic framework that includes two 3-party frameworks with static libraries and then add them as a module for my project. Here are their podspec files
- IndoorsSDK-iOS.podspec (By the way, this is missing a module in the .framework file)
- IndoorAtlas.podspec
I tried to add them as s.dependency
in my podspec file but got the following error
Pods error - target has transitive dependencies that include static binaries
Tried including them like s.vendored_frameworks
but got the following https://github.com/CocoaPods/CocoaPods/issues/6409 and can't do a workaround with the given solution.
Could you please help with how I can handle this and post some test project later to take a closer look at the problem. Now I just have so many different test projects not working that I don't even know what to submit to Github to show.
In most of my attempts, I was unable to use Import IndoorsSDK / IndoorAtlas in my swift fileframes because "No such module" .
Appreciate any help.
source to share
Finally I found a solution. So, if anyone comes across a similar issue, I post it here.
My file, besides other lines, contains the following podspec
#// one library added as dependency, another as vendored_frameworks
#// because it lacks modulemap, so it was added manually to IndooRS framework
spec.dependency 'IndoorAtlas'
spec.vendored_frameworks = 'SKNavigation/Frameworks/IndoorsSDK.framework'
#// following lines fix linking issues so our pod would see dependency modules
spec.pod_target_xcconfig = {
'FRAMEWORK_SEARCH_PATHS' => '$(inherited) $(SRCROOT)/**',
'OTHER_LDFLAGS' => '$(inherited) -undefined dynamic_lookup'
}
And that was added to the Framework that didn't have it modulemap
module IndoorsSDK [system] {
header "Headers/IndoorsSDK.h"
header "Headers/Indoors.h"
export *
link framework "CoreMotion"
link framework "CoreBluetooth"
link "c++"
}
In the latter case, should contain the following to hide the transient errors. podfile
pre_install do |installer|
def installer.verify_no_static_framework_transitive_dependencies; end
end
And that's probably all.
source to share