Create podspec to ship static library

后端 未结 2 1793
别跟我提以往
别跟我提以往 2021-02-14 20:23

I\'m trying to ship a static library via cocoapods. I was given the library without any build directions right now its a drop in to my iOS app. I don\'t need to build the librar

2条回答
  •  眼角桃花
    2021-02-14 20:56

    Sure it's possible, and it's easy. Your podspec looks correct.

    I think you should create a *.framework and put your library and header files inside, so it's easier to manage. Here's an example podspec for a framework:

    Pod::Spec.new do |s|
      s.name             = "LibName"
      s.version          = "0.2.0"
      s.summary          = "MySummary"
    
      s.homepage         = "http://myWebpPage.com/"
    
      s.license          = 'MIT'
      s.author           = { "Author" => "http://author.com/" }
      s.source           = { :git => "https://github.com//Project.git", :tag => s.version.to_s }
    
      s.platform     = :ios, '7.0'
      s.requires_arc = true
      s.ios.vendored_frameworks = 'StaticLibraryFolder/StaticLibrary.framework'
      s.frameworks = 'CoreData' , 'SystemConfiguration', 'CoreLocation'
      s.weak_framework = 'UIKit'
    
    end
    

    If you don't want to do it with a *.framework file, but with *.a and *.h files instead, here's an example.

提交回复
热议问题