const { withPodfile } = require('expo/config-plugins'); const MARKER = '# @generated withPodsDeploymentTarget'; // CocoaPods resource bundle targets (e.g. RNCAsyncStorage_resources, RNSVGFilters) // keep the deployment target declared in their podspec, ignoring `platform :ios`. // Xcode 27 rejects targets below iOS 15, so raise every pod target to the app's minimum. const SNIPPET = ` ${MARKER} min_ios_target = podfile_properties['ios.deploymentTarget'] || '16.4' installer.pods_project.targets.each do |target| target.build_configurations.each do |build_config| current = build_config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] if current.nil? || Gem::Version.new(current) < Gem::Version.new(min_ios_target) build_config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = min_ios_target end end end `; module.exports = function withPodsDeploymentTarget(config) { return withPodfile(config, (config) => { const podfile = config.modResults; if (podfile.contents.includes(MARKER)) { return config; } const anchor = /post_install do \|installer\|\n/; if (!anchor.test(podfile.contents)) { throw new Error('withPodsDeploymentTarget: post_install block not found in Podfile'); } podfile.contents = podfile.contents.replace(anchor, (match) => match + SNIPPET); return config; }); };