上传静态库(protobuf .a)作为cocoapod

时间:2017-04-12 14:42:55

标签: ios xcode cocoapods static-libraries lipo

我似乎无法理解如何将静态库和公共标题上传为cocoapod。我想要实现的只是通过安装这个pod,它会拉.a文件和几个标题,并将它与我的.xcodeproj链接。

  1. 我为所有架构构建了一个protobuf,并制作了一个带有lipo的通用库。
  2. 我将标题和.a文件放入文件夹,压缩并上传到存储空间,并通过公共链接访问它。
  3.     Pod::Spec.new do |s|
          s.name         = "Protobuf"
          s.version      = "0.2.4"
          s.license      = { :type => "MIT" }
          s.homepage     = "https://github.com/Rostyk/Protobuf"
          s.author       = { "Ross" => "ros.aphex@gmail.com" }
          s.summary      = "Protobuf binary"
          s.source       = { :http => 
            'https://www.dropbox.com/s/gon6x99xjp6hh9g/protobuf.zip?dl=1', :tag => "v0.2.4" }
        end

    当我pod lib lint Protobuf.podspec --verbose输出时:

    Protobuf did not pass validation, due to 2 errors and 1 warning.
    [!] The validator for Swift projects uses Swift 3.0 by default, if you
    are using a different version of swift you can use a 
    `.swift-version` file to set the version for your Pod. For example to use Swift 2.3,
    run: `echo "2.3" > .swift-version`.
    You can use the `--no-clean` option to inspect any issue.
    

    我浏览了this article about binary cocoapods

    不幸的是我对pods没有任何经验。也许有人会指出我正确的方向?

1 个答案:

答案 0 :(得分:0)

我设法解决了这个问题。如果有人需要

,那就是工作podspec



Pod::Spec.new do |s|
  s.name     = 'DMProtobuf'
  s.version  = '1.0.1'
  s.license  = 'BSD'
  s.summary  = 'Protobuf for iOS'
  s.description  = 'Static library with protobuf utilities'
  s.homepage = 'https://homepage.sample.com'
  s.author       = 'Google'
  s.source   = { :git => 'https://github.com/YourAccount/Repo.git', :tag => s.version.to_s }
  s.preserve_paths = '*.a'
  s.libraries = 'protobuf'
  s.xcconfig     =  { 'LIBRARY_SEARCH_PATHS' => '$(inherited) "$(PODS_ROOT)/DMProtobuf"' }
  s.platform = :ios
end




另外,请不要忘记使用' 1.0.1'

标记您的分支机构