Podfile详解

资料

基础-Podfile讲解

类似文件

1.生成多个Target

source 'https://github.com/CocoaPods/Specs.git'
# MS 业务组件块spec管理
source 'http://172.16.0.108/zhangshuai/yqmsspecs.git'
# MS 基础组件块spec管理
source 'http://172.16.0.108/YQMSUtils/YQMSUtilsSpec.git'


platform :ios, '9.0'

targetsArray = ['YQMS_4.0','YQMS_4.0Ent']
targetsArray.each do |t|
  target t do
    
    pod 'MSBaseViewController'
    pod 'MSIStarLibrary', :path => '../MSIStarLibrary'
    pod 'Module_Monitoring', :path => '../Module_Monitoring'
    pod 'Module_DetailPage', :path => '../Module_DetailPage'
    pod 'IQKeyboardManager'
    pod 'Module_Filter' ,:path => '../Module_Filter'
    pod 'MSNetwork', :path => '../MSNetwork'
    pod 'MSIflyMSC', :path => '../MSIflyMSC'

    
    pod 'MSMiddleWare', :path => '../MSMiddleWare'
    pod 'Module_Tree' ,:path=>'../Module_Tree'
    
  end

end

2. 单个Target

# 下面两行是指明依赖库的来源地址
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/Artsy/Specs.git'

# 说明平台是ios,版本是9.0
platform :ios, '9.0'

# 忽略引入库的所有警告(强迫症者的福音啊)
inhibit_all_warnings!

# 针对MyApp target引入AFNetworking
# 针对MyAppTests target引入OCMock,
target 'MyApp' do 
    pod 'AFNetworking', '~> 3.0' 
    target 'MyAppTests' do
       inherit! :search_paths 
       pod 'OCMock', '~> 2.0.1' 
    end
end
# 这个是cocoapods的一些配置,官网并没有太详细的说明,一般采取默认就好了,也就是不写.
post_install do |installer|       
   installer.pods_project.targets.each do |target| 
     puts target.name 
   end
end

多工程管理

source 'http://172.16.0.108/zhangshuai/yqmsspecs.git'
source 'http://172.16.0.108/YQMSUtils/YQMSUtilsSpec.git'
source 'https://github.com/CocoaPods/Specs.git'

workspace 'yqms.xcworkspace'
# 主工程
project 'YQMS_4.0/YQMS_4.0.xcodeproj'

def commonPods
  pod 'Masonry'
#  pod 'AFNetworking', '~>3.2.1'
  pod 'MBProgressHUD', '~>1.1.0'
  pod 'MSBaseViewController'
  pod 'MJRefresh'
  pod 'MJExtension'
  pod 'SDWebImage'
  pod 'IQKeyboardManager'
#  pod 'MSHud'
# pod 'MSIStarLibrary' ,:path => '../MSIStarLibrary'
# pod 'Module_Monitoring', :path => '../Module_Monitoring'
# :git=>'[email protected]:zhangshuai/msistarlibrary.git', :tag=>'0.0.5'
# :path => '..秘书4.0/MSIStarLibrary'
end

target 'YQMS_4.0' do
    platform :ios, '9.0'
#    use_frameworks!
    project 'YQMS_4.0/YQMS_4.0.xcodeproj'
    commonPods
    pod 'Module_DetailPage', :path => './Module_DetailPage'
    pod 'MSIStarLibrary' ,:path => './MSIStarLibrary'
    pod 'Module_Monitoring', :path => './Module_Monitoring'
    pod 'MSNetwork', :path => './MSNetwork'
#    pod 'MSNetworking', :path => './MSNetworking'
    pod 'MSIStarLibrary' ,:path => './MSIStarLibrary'
    pod 'MSNetworking'
    pod 'Module_Tree' ,:path=>'./Module_Tree'
end


target 'Module_Monitoring' do
  platform :ios, '9.0'
#  use_frameworks!
#  inherit! :search_paths
  project 'Module_Monitoring/Module_Monitoring.xcodeproj'
  commonPods

  pod 'DKNightVersion'
  pod 'Module_DetailPage', :path => './Module_DetailPage'
  pod 'MSIStarLibrary' ,:path => './MSIStarLibrary'
  pod 'Module_Filter' ,:path => './Module_Filter'
  pod 'MSMiddleWare', :path=>'./MSMiddleWare'
  pod 'MSMediator', :path=>'./MSMediator'
  pod 'MSNetworking'
  pod 'MSCategory'
  pod 'MSHud' , :path=>'./MSHud'
  pod 'MJExtension'
  pod 'Module_Tree' ,:path=>'./Module_Tree'
  pod 'MSIflyMSC'
end



target 'Module_Filter' do
  platform :ios, '9.0'
  project 'Module_Filter/Module_Filter.xcodeproj'
  pod 'MSIStarLibrary' ,:path => './MSIStarLibrary'
  pod 'MSNetwork', :path => './MSNetwork'
#  pod 'MSCategory', :path => './MSCategory'
  pod 'MSCategory'
  pod 'JXCategoryView', '~> 1.5.2'
  pod 'MSHud' , :path=>'./MSHud'
  pod 'MSNetworking'
end

target 'Module_DetailPage' do
  platform :ios, '9.0'
  project 'Module_DetailPage/Module_DetailPage.xcodeproj'
  commonPods
  pod 'MSIStarLibrary' ,:path => './MSIStarLibrary'
  pod 'MSNetwork', :path => './MSNetwork'
  pod 'MSMiddleWare', :path=>'./MSMiddleWare'
  pod 'MSMediator', :path=>'./MSMediator'
  pod 'MSNetworking'
  pod 'MSCategory'
  pod 'MSHud' , :path=>'./MSHud'
  pod 'MSShare'
  pod 'MSIflyMSC'
end


target 'MSNetwork' do
  platform :ios, '9.0'
  project 'MSNetwork/MSNetwork.xcodeproj'
  pod 'YTKNetwork'
#  pod 'RestKit', '~> 0.24.0'
  commonPods
end

target 'MSCategory' do
  platform :ios, '9.0'
  project 'MSCategory/MSCategory.xcodeproj'
  commonPods
end

#target 'MSMiddleWare' do
#  platform :ios, '9.0'
#  project 'MSMiddleWare/MSMiddleWare.xcodeproj'
#end

target 'MSMediator' do
  platform :ios, '9.0'
  project 'MSMediator/MSMediator.xcodeproj'
end


target 'MSIStarLibrary' do
  platform :ios, '9.0'
  project 'MSIStarLibrary/MSIStarLibrary.xcodeproj'
  commonPods
end

你可能感兴趣的:(IOS高级)