Create podspec to ship static library

杀马特。学长 韩版系。学妹 提交于 2019-12-03 13:03:46

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/<GITHUB_USERNAME>/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.

I think you need do like that demo

 Pod::Spec.new do |s|
 s.name         = "RTMPLib Library"
 s.version      = "1.0.0"
 s.summary      = "RTMPLib Library"
 s.homepage     = "https://github.com/jumper/RTMPLib.git"
 s.license      = { :type => 'MIT', :file => 'LICENSE' }
 s.author       = { "jon morehouse" => "jon@jumperapp.com" }
 s.source       = { :git => "https://github.com/jumper/RTMPLib.git", :tag => "#{s.version}" }
 s.platform     = :ios, '7.0'

 # arc components
 s.requires_arc = false
# you static library`s .h file
 s.source_files = 'lib/*.h'
 s.vendored_libraries = 'lib/rtmplib.a'

end
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!