最基本写法
target 'MyApp' do
pod 'AFNetworking', '~> 3.0'
end
普遍写法
# 下面两行是指明依赖库的来源地址
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/Artsy/Specs.git'
# 平台,版本
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的一些配置,官网并没有太详细的说明,一般采取默认就好了,也就是不写.
一些依赖写法
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git' //默认master
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :branch => 'develop'
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git',:tag => '0.7.0'
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit => '082f6719af'
pod 'AFNetworking', :path =>'/Users/XXXXX/XXXXX/XXXXX/AFNetworking'
pod 'JSONKit', :podspec => 'https://example.com/JSONKit.podspec'