本文介绍了如何使用Cocoapods建立基于两个静态库的动态框架(Swift)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个动态框架,该框架将两个3方框架与静态库结合在一起,然后将其作为吊舱添加到我的项目中.这是他们的podspec文件

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

我尝试将它们添加为我的podspec文件中的s.dependency,但出现以下错误Pods error - target has transitive dependencies that include static binaries

I tried to add them as s.dependency in my podspec file but got following errorPods error - target has transitive dependencies that include static binaries

试图将它们包含为s.vendored_frameworks,但得到了 https://github.com/CocoaPods的支持/CocoaPods/issues/6409 ,并且无法使用给定的解决方案.

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.

您能帮忙我如何处理它的方向,以后我会发布一些测试项目以更仔细地研究问题.现在我只是有很多无法使用的测试项目,以至于我什至都不知道要发布到Github上显示什么内容.

Could you help with the direction how I can deal with it and later I'llpost 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.

在大多数尝试中,由于无此模块" 错误,我最终无法在我的框架swift文件中使用Import IndoorsSDK/IndoorAtlas.

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.

感谢任何帮助.

推荐答案

最后,我找到了解决方案.因此,如果有人遇到类似问题,我可以在此处发布.

Finally, I've found the solution. So, in case someone run into similar issue, I post it here.

我的 podspec 文件,但其他行包含以下

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'
  }

modulemap ,它被添加到缺少它的框架中

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++"
}

最新点 podfile 应该包含以下内容,以隐藏传递依赖项错误.

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

那可能就是全部.

这篇关于如何使用Cocoapods建立基于两个静态库的动态框架(Swift)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 01:25