How to make a dynamic framework(Swift) based on tw

2020-07-14 05:32发布

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

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条回答
时光不老,我们不散
2楼-- · 2020-07-14 06:19

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.

查看更多
登录 后发表回答