From f5afa94b3b9c246d87b2af03359840f503bace90 Mon Sep 17 00:00:00 2001 From: Mike Summerfeldt <20338451+IT-MikeS@users.noreply.github.com> Date: Wed, 27 Jul 2022 10:19:59 -0400 Subject: [PATCH] feat(iOS): post install script for deployment target (#5783) * feat: post install script for deployment target * chore: fix path to helper file * chore: put post_install in better spot Co-authored-by: jcesarmobile --- ios-template/App/Podfile | 6 ++++++ ios/scripts/pods_helpers.rb | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 ios/scripts/pods_helpers.rb diff --git a/ios-template/App/Podfile b/ios-template/App/Podfile index 8594fc2cdd..affb695cb6 100644 --- a/ios-template/App/Podfile +++ b/ios-template/App/Podfile @@ -1,3 +1,5 @@ +require_relative '../../node_modules/@capacitor/ios/scripts/pods_helpers' + platform :ios, '13.0' use_frameworks! @@ -15,3 +17,7 @@ target 'App' do capacitor_pods # Add your Pods here end + +post_install do |installer| + assertDeploymentTarget(installer) +end diff --git a/ios/scripts/pods_helpers.rb b/ios/scripts/pods_helpers.rb new file mode 100644 index 0000000000..7a9fa41f42 --- /dev/null +++ b/ios/scripts/pods_helpers.rb @@ -0,0 +1,12 @@ +def assertDeploymentTarget(installer) + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + # ensure IPHONEOS_DEPLOYMENT_TARGET is at least 13.0 + deployment_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f + should_upgrade = deployment_target < 13.0 && deployment_target != 0.0 + if should_upgrade + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' + end + end + end +end \ No newline at end of file