Closed jianjianhao closed 4 years ago
DEPLOYMENT_VERSION = '9.0'.freeze
DEPLOYMENT_TARGET_KEY = 'IPHONEOS_DEPLOYMENT_TARGET'.freeze
PODS_MIN_DEPLOYMENT_VERSION = '9.0'.freeze
platform :ios, DEPLOYMENT_VERSION
target 'xxx' do
...
end
# https://github.com/CocoaPods/CocoaPods/issues/7314#issuecomment-489453484
def fix_deployment_targets(installer)
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configuration_list.build_configurations.each do |config|
if config.build_settings[DEPLOYMENT_TARGET_KEY].to_f < PODS_MIN_DEPLOYMENT_VERSION.to_f
config.build_settings[DEPLOYMENT_TARGET_KEY] = PODS_MIN_DEPLOYMENT_VERSION
puts "Successfully set #{DEPLOYMENT_TARGET_KEY} of target #{target.name} for config #{config.display_name} to #{PODS_MIN_DEPLOYMENT_VERSION}"
end
end
end
end
end
post_install do |installer|
fix_deployment_targets installer
end
https://github.com/CocoaPods/CocoaPods/issues/7314#issuecomment-489453484
thank you for your help