case: 我司对外提供sdk, 源码隐藏, 只暴露header. 我自己的framework中依赖了其他的framework.
1. 创建一个pod开发模式workspace, 项目名字为LiveCore
命令行输入:
pod lib create LiveCore
接着会提示你是否要demo / OC? swift? / 文件前缀, 不赘述.
WechatIMG571.jpeg2.成功后会有一个BJLiveCore.podsepc
#
# Be sure to run `pod lib lint LiveCore.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'LiveCore'
s.version = '0.1.0'
s.summary = 'A short description of LiveCore.'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/oushizishu/LiveCore'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { '' => '' }
s.source = { :git => '这里改成你自己的仓库名字', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '8.0'
s.source_files = 'LiveCore/Classes/**/*'
# s.resource_bundles = {
# 'LiveCore' => ['LiveCore/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
需要注意:
- s.source
3.如果这个LIveCore需要依赖BJHLMediaplay.framework
WechatIMG572.jpeg在LiveCore的同级目录新建一个frameworks文件, 当然这个文件夹名字, 你可以随便起, 只要不是中文就好, 然后把BJHLMediaplay.framework拉进来
接下来就需要改LiveCore.podsec里面的内容了
4.LiveCore.podsec
#
# Be sure to run `pod lib lint LiveCore.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'LiveCore'
s.version = '0.1.0'
s.summary = 'A short description of LiveCore.'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/oushizishu/LiveCore'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'oushizishu' => 'xinyapeng@baijiahulian.com' }
s.source = { :git => 'https://github.com/oushizishu/LiveCore.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '8.0'
s.source_files = 'LiveCore/Classes/**/*'
s.subspec 'BJHLMediaPlayer' do |ss|
ss.vendored_frameworks = 'frameworks/BJHLMediaPlayer.framework'
# ss.xcconfig = {'ENABLE_BITCODE' => 'NO'}
# ss.libraries = ['icucore', 'c++', 'stdc++.6', 'z']
# ss.frameworks = ['AVFoundation', 'GLKit', 'VideoToolbox']
# ss.dependency 'AFNetworking', '~> 2.3'
end
# s.resource_bundles = {
# 'LiveCore' => ['LiveCore/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
注意
s.subspec 'BJHLMediaPlayer' do |ss|
# 这个路径要正确
ss.vendored_frameworks = 'frameworks/BJHLMediaPlayer.framework'
# 以下根据需要添加
# ss.xcconfig = {'ENABLE_BITCODE' => 'NO'}
# ss.libraries = ['icucore', 'c++', 'stdc++.6', 'z']
# ss.frameworks = ['AVFoundation', 'GLKit', 'VideoToolbox']
# ss.dependency 'AFNetworking', '~> 2.3'
end
5.打包
打包分为静态库和动态库, 网上很多教程, 不赘述.
网友评论