创buildpodspec来运送静态库

我试图通过cocoapods发运一个静态库。 我被授予了图书馆没有任何build立方向现在它的一个下降到我的iOS应用程序。 我不需要为使用它的每个应用程序构build库,而只需要下载lib文件并包含头文件。 有没有办法做到这一点与podspec文件?

这是我到目前为止:

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 s.preserve_paths = 'inc/rtmplib/*.h' s.vendored_libraries = 'lib/rtmplib.a' s.libraries = 'rtmplib' s.xcconfig = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/#{s.name}/inc/rtmplib/**'} s.preserve_paths = 'L.framework' end 

实际的代码结构可以在这里find: Git Repo

当然这是可能的,而且很容易。 你的podspec看起来是正确的。

我认为你应该创build一个* .framework并把你的库和头文件放在里面,所以pipe理起来更容易。 以下是一个框架的示例podspec:

 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 

如果你不想用* .framework文件来做,而用* ​​.a和* .h文件来代替, 这里是一个例子。

我想你需要做那样的演示

  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 
Interesting Posts