CocoaPods podfile 文件配置

记录一下关于 CocoaPods podfile 文件配置

  • 指定源(Source)
    默认情况下,在全局级别指定的源将按照依赖项匹配指定的顺序进行搜索。
    对于特定的依赖,可以单独指定依赖源:
pod 'PonyDebugger', :source => 'https://github.com/CocoaPods/Specs.git'
  • 使用字库(Subspecs)
    当通过Pod的名称安装Pod时,它将安装podspec文件中定义的所有默认subspecs
    可以使用下面的方式导入特定的subspec
pod 'QueryKit/Attribute'

or

pod 'QueryKit', :subspecs => ['Attribute', 'QuerySet']
  • 使用本地私有库(自己创建的本地库)
pod 'AFNetworking', :path => '~/Documents/AFNetworking'

注意,本地私有库中的,podspec文件必须在该文件夹中。

  • 制定分支或者commit

指定源,默认是master分支

pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git'

指定其他分支

pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :branch => 'dev'

使用tag

pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :tag => '0.7.0'

特殊的commit

pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit => '082f8319af'

podspec文件应该位于存储库的cocopods 存放的根目录中,如果这个库的存储库中还没有podspec文件,可以从其它来源获得:

pod 'JSONKit', :podspec => 'https://example.com/JSONKit.podspec'

猜你喜欢

转载自blog.csdn.net/tongwei117/article/details/134442056