【问题标题】:Static libraries not linked in Link Binary with Cocoapods静态库未在链接二进制文件中与 Cocoapods 链接
【发布时间】:2015-03-19 16:15:20
【问题描述】:

我正在使用 Cocoapods 0.36.0.beta.1

如果我的规范中有一个静态库 libssl.a,可在 TestSpec/Libs 中找到,并且我将它作为一个供应商库包含,它似乎没有链接到目标项目中

这是我的 podspec 文件:

Pod::Spec.new do |s|
  s.name             = "TestSpec"
  s.version          = "0.0.1"
  s.summary          = "Test"
  s.homepage         = "https://www.google.com"
  s.author           = { "Ciprian Caba" => "1@2.com" }

  s.platform     = :ios, '8.0'
  s.requires_arc = true

  s.source           = { :git =>     "https://github.com/CocoaPods/CocoaPodsTest.git", :tag => s.version.to_s }

  s.source_files = 'TestSpec/*.{h,c,m,swift}'
  s.resource_bundles = {
    'TestSpecBundle' => ['TestSpec/*.png']
  }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  s.frameworks = 'UIKit'
  s.vendored_libraries = 'TestSpec/Libs/libssl.a'
  s.libraries = 'ssl'
end

这是我的 Podfile

platform :ios, '8.0'

target 'TestApp' do

pod 'TestSpec', :path => '../TestSpec'

end

在目标项目中发生的情况是 libssl.a 文件被包含在内,Libs 文件夹的路径被添加到搜索路径中,但在 Build Phases 选项卡上没有与 a 文件进行链接。据我了解,这应该是因为 s.libraries = 'ssl'

经过将近一天的挣扎和测试,我无法理解自己做错了什么

我还创建了一个带有 test project 的仓库

【问题讨论】:

    标签: xcode swift xcode6 cocoapods


    【解决方案1】:

    显然,这些库永远不会添加到 Build Phases 选项卡中,而是会将以下行添加到 Other Linker Flags:

    -l"ssl"
    

    这实际上会使 .a 文件与目标一起构建,并且它永远不需要到达构建阶段选项卡

    【讨论】:

      猜你喜欢
      • 2013-10-06
      • 2015-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多