如何使用Cocoapods基于两个静态库制作动态框架(Swift)

时间:2017-04-25 10:25:01

标签: ios swift frameworks cocoapods podspec

我想制作一个动态框架,其中包含两个带静态库的第三方框架,然后将其作为pod添加到我的项目中。 这是他们的podspec文件

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

尝试将它们包含为s.vendored_frameworks,但却遵循https://github.com/CocoaPods/CocoaPods/issues/6409并且无法使用给定的解决方案进行解决。

你能帮忙解决一下如何处理这个问题的方法吗? 发布一些测试项目来更仔细地看待问题。现在我只是有很多不同的测试项目,我甚至都不知道要发布给Github展示什么。

在我的大多数尝试中,我最终无法在我的框架swift文件中使用Import IndoorsSDK / IndoorAtlas,因为“没有这样的模块”错误。

感谢任何帮助。

1 个答案:

答案 0 :(得分:2)

最后,我找到了解决方案。所以,如果有人遇到类似的问题,我会在这里发布。

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

modulemap ,已添加到缺少该框架的框架中

module IndoorsSDK [system] {
    header "Headers/IndoorsSDK.h"
    header "Headers/Indoors.h"
    export *
    link framework "CoreMotion"
    link framework "CoreBluetooth"
    link "c++"
}

最新点 podfile 应包含以下隐藏传递依赖项错误。

pre_install do |installer|
    def installer.verify_no_static_framework_transitive_dependencies; end
end

这可能都是。

相关问题