Podfile

266 阅读1分钟
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0' #指定平台
inhibit_all_warnings! #忽略所有警告
# 全局source
source 'https://github.com/CocoaPods/Specs.git' #官方默认源
source 'http://pods.lp.com/CocoaPods/Specs' #私有源

target 'layerpath' do #指定这个target需要依赖的库
    # Comment the next line if you don't want to use dynamic frameworks
    use_frameworks!

    # 特定source,指定特定源中搜索,并忽略任何全局source
    pod 'FMDB', :source => 'https://github.com/CocoaPods/Specs.git'

    # 指定版本
    pod 'AFNetworking', '~> 4.1.3'
    # 指定git(默认主分支)
    pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git'
    # 指定分支:branch
    pod 'MJExtension', :git => 'https://github.com/CoderMJLee/MJExtension.git',branch => 'uat'
    # 指定标签:tag
    pod 'PureLayout', :git => 'https://github.com/xxx/PureLayout.git',tag => '0.5.3'
    # 指定commit
    pod 'UITextView+Placeholder', :git => 'https://github.com/xxx/TextViewPlaceholder.git',commit => 'dsjkhsfgj'
    # 指定路径(一般调试用)
    pod 'WJScrollSegment', :path => '/Users/onewj/Desktop/WJScrollSegment'

  pod 'YYImage'  # 不写具体的版本号,默认为最新版本
  pod 'YYImage', '1.0.4' # 想要依赖库特定的版本,后面需要指定版本号
  pod 'YYImage', '> 1.1' # 高于 1.1 (不包含 1.1) 的任何版本
  pod 'YYImage', '>= 1.1' # 高于 1.1 (包含 1.1) 的任何版本
  pod 'YYImage', '< 1.1' # 小于 1.1 (不包含 1.1) 的任何版本
  pod 'YYImage', '<= 1.1'# 小于 1.1 (包含 1.1) 的任何版本
  pod 'YYImage', '~> 1.1' # >= 1.1 且< 2 的任何版本,并且始终是指定范围的最新版本
  pod 'YYImage', '~> 1.0.1' # >= 1.0.1 且< 1.1.0 的任何版本,并且始终是指定范围的最新版本
  #指定子模块
  pod 'Query/Attr'

  #指定子模块合集
  pod 'Query',subspecs => ['Attr','QuerySet']
end
  • 关于podfile.lock
    • 记录了之前pod加载时的一些信息,包括版本、依赖、CocoaPods版本等

    • 多人开发遇到冲突 pod install --repo-update 或者 pod repo update

    • 最后若是仍然有冲突,可删除本地podfile.lock文件,再更新