case: 我司對外提供sdk, 源碼隱藏, 只暴露header. 我自己的framework中依賴了其他的framework.
1. 創(chuàng)建一個pod開發(fā)模式workspace, 項目名字為LiveCore
命令行輸入:
pod lib create LiveCore
接著會提示你是否要demo / OC? swift? / 文件前綴, 不贅述.
2.成功后會有一個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
在LiveCore的同級目錄新建一個frameworks文件, 當(dāng)然這個文件夾名字, 你可以隨便起, 只要不是中文就好, 然后把BJHLMediaplay.framework拉進(jìn)來
接下來就需要改LiveCore.podsec里面的內(nèi)容了
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'
# 以下根據(jù)需要添加
# ss.xcconfig = {'ENABLE_BITCODE' => 'NO'}
# ss.libraries = ['icucore', 'c++', 'stdc++.6', 'z']
# ss.frameworks = ['AVFoundation', 'GLKit', 'VideoToolbox']
# ss.dependency 'AFNetworking', '~> 2.3'
end
5.打包
打包分為靜態(tài)庫和動態(tài)庫, 網(wǎng)上很多教程, 不贅述.