Ios 创建podspec以发布静态库
我正试图通过cocoapods发布一个静态库。我现在得到了没有任何构建说明的库,这是我的iOS应用的一个插件。我不需要为使用它的每个应用程序构建库,只需下载lib文件并包含头文件。有没有办法用podspec文件实现这一点 到目前为止,我所掌握的情况如下:Ios 创建podspec以发布静态库,ios,objective-c,static-libraries,cocoapods,.a,Ios,Objective C,Static Libraries,Cocoapods,.a,我正试图通过cocoapods发布一个静态库。我现在得到了没有任何构建说明的库,这是我的iOS应用的一个插件。我不需要为使用它的每个应用程序构建库,只需下载lib文件并包含头文件。有没有办法用podspec文件实现这一点 到目前为止,我所掌握的情况如下: Pod::Spec.new do |s| s.name = "RTMPLib Library" s.version = "1.0.0" s.summary = "RTMPLib Library"
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
实际的代码结构可以在这里找到:确保这是可能的,而且很简单。你的podspec看起来是正确的 我认为您应该创建一个*.framework,并将库和头文件放在其中,这样更易于管理。下面是框架的一个示例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
Pod::Spec.new do|s|
s、 name=“LibName”
s、 version=“0.2.0”
s、 summary=“MySummary”
s、 主页=”http://myWebpPage.com/"
s、 许可证='MIT'
s、 作者={“作者”=>“http://author.com/" }
s、 source={:git=>”https://github.com//Project.git“,:tag=>s.version.to_s}
s、 平台=:ios,“7.0”
s、 需要_弧=真
s、 ios.vendored_frameworks='StaticLibraryFolder/StaticLibrary.framework'
s、 框架='CoreData','SystemConfiguration','CoreLocation'
s、 弱_框架='UIKit'
结束
如果您不想使用*.framework文件,而是使用*.a和*.h文件,请举个例子。我认为您需要这样做
这似乎是一个类似的问题:你的Git回购链接被破坏了。我不知道你在说什么,这对我来说毫无意义。请仔细阅读苹果系统中的“*.framework”扩展——它基本上是一个文件夹,这怎么会使任何东西更难管理?未来的建议:当你认为某人错了,不要屈尊俯就,试着用笑来侮辱他们。也许试着进行一次民事讨论?特别是可能会发现你错了。祝你度过愉快的一天,在Stackoverflow上有很多很多的笑声!正在使用
s.ios.vendored_frameworks
帮助通过cocopods发布静态库。是否有可能将其视为动态库?
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