为第三方静态库创建podspec

时间:2013-11-15 16:35:43

标签: ios cocoapods

我正在尝试构建一个包含第三方静态库和一些源代码的可可pod。我无法让链接器找到该库。我的目录结构是:

classes
-- (my .m and .h files)
libs
  foo.z    #-- third party static library

当我构建时,我收到链接器错误:

ld: library not found for -llibs/foo.a

我的podspec如下

Pod::Spec.new do |s|

  s.name         = "FOO"
  s.version      = "0.0.1"
  s.summary      = "summary"

  s.description  = <<-DESC
                   description
                   DESC

  s.homepage     = "xxx"
  s.license      = 'MIT'
  s.author       = { "me" => "me@xyz.com" }
  s.platform     = :ios, '6.1'
  s.ios.deployment_target = '6.1'
  s.source       = { :git => "https://github.com/<some repository>" }
  s.source_files  = 'Classes', 'Classes/**/*.{h,m}'

  s.preserve_paths   = 'libs/foo.a'
  s.vendored_library = 'libs/foo.a'

  s.library     = 'foo'

  s.public_header_files = 'Classes/**/*.h'
  s.requires_arc = true

end

1 个答案:

答案 0 :(得分:0)

s.library = 'foo'可能是您的问题。

library属性表示要与相关联的库,例如xml2zlib等,看起来您似乎在告诉它要查找名称为您的库的第三方库。

请参阅文档here