【问题标题】:How to make a dynamic framework(Swift) based on two static libraries using Cocoapods如何使用 Cocoapods 制作基于两个静态库的动态框架(Swift)
【发布时间】:2017-09-22 07:32:24
【问题描述】:

我想制作一个动态框架,将两个 3-rd 方框架与静态库结合起来,然后将其作为 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,因为 “没有这样的模块” 错误。

感谢任何帮助。

【问题讨论】:

    标签: ios swift frameworks cocoapods podspec


    【解决方案1】:

    终于,我找到了解决方案。所以,如果有人遇到类似的问题,我把它贴在这里。

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

    大概就这些了。

    【讨论】:

      猜你喜欢
      • 2015-09-17
      • 2014-07-25
      • 1970-01-01
      • 2023-03-07
      • 2015-07-18
      • 1970-01-01
      • 2020-07-05
      • 2022-12-30
      • 1970-01-01
      相关资源
      最近更新 更多