记录下项目中podfile文件用到的配置对应的含义。
附上一些参考链接:
www.jianshu.com/p/6458b5417…
developer.aliyun.com/article/370…
use_frameworks!
use_frameworks! #使用默认值,根据pod类型自行设置static或者dynamic
use_frameworks! :linkage => :static # 使用静态链接
use_frameworks! :linkage => :dynamic #使用动态链接
# 不指定则采用默认值,iOS默认值为4.3
# 对导入的库的最低版本限制,即子库必须至少向下兼容到10.0。即子库deployment_target<=10.0
platform :ios, '10.0'
#抽象target,pod项可被多个target继承
abstract_target 'Shows' **do**
pod 'podCommon'
# target1继承了podCommon+自己添加的podTarget1
target 'target1' **do**
pod 'podTarget1'
**end**
# target2继承了podCommon+自己添加的podTarget2
target 'target2' **do**
pod 'podTarget2'
**end**
# configurations 设置库Reveal-SDK 只在Debug时编译(一些只需要在特定配置环境下参与编译
的库)configurations可以配置多个
pod 'Reveal-SDK', '24', :configurations => ['Debug','Release'], :binary => prebuild_enabled
# binary 依赖的组件选择性打包成二级制
# pod二进制化指的是通过编译把pod中的第三方库源码转换成静态库或动态库,从而提高App项目中的
编译速度。对比完整编译源码,二进制化的三方库省去了编译阶段,直接进行链接
# 如果全部库均需要二进制化, 直接在起始位置使用all_binary!
pod 'YYKit', :binary => **true**
# 实现post_install Hooks
# 有时候我们想在pod install/update时做一些除了第三方库安装以外的事情,比如关闭所有target
的Bitcode功能。这时就要用到CocoaPods中的钩子(Hooks)
post_install do |installer|
# 1. 遍历项目中所有target
installer.pods_project.targets.each do |target|
# 2. 遍历build_configurations
target.build_configurations.each do |config|
# 3. 修改build_settings中的ENABLE_BITCODE
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
# 将所有三方库的部署版本号强制修改到Xcode支持的范围内,代码如下:
post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
end
end
**end**