问题
I want to make a dynamic framework that incorporates two 3-rd party frameworks with static libraries and later add it as a pod to my project. Here are their podspec files
- IndoorsSDK-iOS.podspec (By the way, this one lacks modulemap in .framework file)
- IndoorAtlas.podspec
I tried to add them as s.dependency
in my podspec file but got following error
Pods error - target has transitive dependencies that include static binaries
Tried to include them as s.vendored_frameworks
but got following https://github.com/CocoaPods/CocoaPods/issues/6409 and can't make workaround with the given solution.
Could you help with the direction how I can deal with it and later I'll post some test project to look at the issue closer. Now I simply have so many different test projects that don't work that I don't even know what to post to Github to show.
In most of my attempts I ended up not being able to use Import IndoorsSDK/IndoorAtlas in my framework swift files because "No such module" error.
Appreciate any help.
回答1:
Finally, I've found the solution. So, in case someone run into similar issue, I post it here.
My podspec
file except other lines contains following
#// 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 modulemap
, that was added to the Framework that lacked it
module IndoorsSDK [system] {
header "Headers/IndoorsSDK.h"
header "Headers/Indoors.h"
export *
link framework "CoreMotion"
link framework "CoreBluetooth"
link "c++"
}
The latest point, podfile
should contain following to hide transitive dependencies error.
pre_install do |installer|
def installer.verify_no_static_framework_transitive_dependencies; end
end
And that's probably all.
来源:https://stackoverflow.com/questions/43608066/how-to-make-a-dynamic-frameworkswift-based-on-two-static-libraries-using-cocoa