CocoaPods podfile 文件配置

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

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

or

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

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

  • 制定分支或者commit

指定源,默认是master分支

bash 复制代码
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git'

指定其他分支

bash 复制代码
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :branch => 'dev'

使用tag

bash 复制代码
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :tag => '0.7.0'

特殊的commit

bash 复制代码
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit => '082f8319af'

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

bash 复制代码
pod 'JSONKit', :podspec => 'https://example.com/JSONKit.podspec'
相关推荐
gavin carter12 天前
一台电脑管理多个cocoapods账号
xcode·cocoapods
明似水14 天前
解决 Ruby Gem “rexml“ 版本不兼容问题 (CocoaPods/Firebase 相关错误)
开发语言·ruby·cocoapods
守城小轩14 天前
Chromium 136 编译指南 macOS篇:Xcode安装与配置(二)
macos·xcode·策略模式
march of Time15 天前
go在for循环中使用errgroup和channel进行并发处理
开发语言·golang·xcode
YungFan18 天前
Xcode26新特性与iOS26适配指南
ios·xcode
survivorsfyh20 天前
Xcode 16 集成 cocoapods 报错
macos·xcode·cocoapods
survivorsfyh21 天前
error: Sandbox: rsync(17136) deny(1) file-write-create
xcode·cocoapods