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