podspace 文件编写及 podfile 引用

.podspace 文件编写范例
Pod::Spec.new do |s|
  s.name         = "Pods-xxx"
  s.version      = "1.1.3"
  s.summary      = "CocoaPods for xxx"

  s.description  = <<-DESC
            Using CocoaPods to import Internet-Hospital classes into your project. 
                   DESC

  s.homepage     = "http://192.168.0.116/zlx/Pods-xxx"
  s.license      = "MIT"
  s.author       = { "zlx" => "[email protected]" }
  s.platform     = :ios, "8.0"
  s.source       = { :git => "http://192.168.100.222/zlx/Pods-xxx.git", :tag => "#{s.version}" }

  s.source_files  = "Headers/*.{h}"
  #s.exclude_files = "Classes/Exclude"

  s.public_header_files = "Headers/*.h"
  s.resources = "Resources/Images/**/*.{png,jpg}", "Resources/Sound/**/*.caf",  "Resources/*.bundle","Resources/*.gif", "Icon.xcassets"
  s.preserve_paths = "libITH.a"
  s.vendored_libraries = "libITH.a"
  s.vendored_frameworks = "FrameWorks/*.framework"

  s.frameworks = "AVFoundation", "AudioToolBox", "CoreGraphics", "CoreMedia", "CoreTelephony", "CoreVideo", "Foundation", "UIKit", "ImageIO", "OpenAL"
  s.libraries = "iconv", "xml2",  "c++", "stdc++", "stdc++.6", "sqlite3", "z", "resolv", "z.1.2.5"

  s.requires_arc = true

  # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
  #s.verify_framework_usage 
  s.dependency "AFNetworking", "~> 3.1.0"
  s.dependency "MBProgressHUD", "~> 0.9.2"
  #s.dependency "UMengUShare/Social/WeChat", "~> 6.4.5"
  s.dependency "JSONModel", "~> 1.7.0"
  s.dependency "AMapLocation"
  s.dependency "WeChatSDKPods", '~> 1.6.1'
end

解读:

s.frameworks            #需要的系统库支持
s.libraries             #需要的静态库
s.dependency            #需要的第三方库依赖
s.vendored_libraries    #需要手动加入的静态库
s.vendored_frameworks   #需要手动加入的 framework
注意:

1. Resources 下虽然可以引用 .xcassets 资源文件,在执行 pod setup 时也可以正常的更新到 pods 下面,但是在里面的内容在引用的时候却无法正常显示,换作 .bundle就可以;
2. 引用的第三方库最好有个统一管理的地方,在多人合作时可以统一使用一个固定的版本,以免因版本不同引发冲突或者报错;
3. 注意 s.versiongit tag 的同步使用,在执行 pod update 时,如果指定了引用的版本,那么必须修改 s.version 才能更新成功。

.podfile 引用范例
pod 'Pods-xxx', :git =>'http://192.168.100.222/zlx/Pods-xxx.git'

如果需要特定版本

pod 'Pods-xxx', :git =>'http://192.168.100.222/zlx/Pods-xxx.git', :tag => '1.0.6'

指定特定分支

pod 'Pods-xxx', :git =>'http://192.168.100.222/zlx/Pods-xxx.git', :branch => 'myBranch'

你可能感兴趣的:(podspace 文件编写及 podfile 引用)