Skip to main content
Skip to navigation

CocoaPods builds fail with a deployment target error

Fix the deployment target error Xcode 27 shows for RevenueCat pods installed with CocoaPods

AIAsk AIChatGPTClaude

Issue Description​

Xcode 27 fails the build for any target whose deployment target is lower than iOS 15.0, tvOS 15.0, watchOS 9.0, or macOS 12.0. Earlier Xcode versions only showed a warning.

CocoaPods builds each pod for the minimum version the pod declares, not for your app's deployment target. The RevenueCat pods declare iOS 13.0, so the targets CocoaPods generates for them fail to build in Xcode 27. This happens even when your app's deployment target is iOS 15.0 or later.

Projects that install RevenueCat with Swift Package Manager aren't affected.

Affected Versions​

  • Xcode 27
  • Apps that install RevenueCat's iOS dependencies with CocoaPods, including React Native, Expo SDK 56 and earlier, Cordova, Unity, and Kotlin Multiplatform apps

Symptoms​

The build fails with an error similar to:

The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 13.0, but the range of supported deployment target versions is 15.0 to 27.0.x.

The error names one or more targets from the Pods project:

  • The pod targets, such as RevenueCat, RevenueCatUI, and PurchasesHybridCommon.
  • Their resource bundle targets, such as RevenueCat-RevenueCat, RevenueCatUI-RevenueCat_RevenueCatUI, and PurchasesHybridCommon-PurchasesHybridCommon.

In React Native 0.76 and later, including Expo SDK 56 and earlier, the error names only the resource bundle targets. React Native's react_native_post_install raises the deployment target of each pod's main target, but not of its resource bundles.

Workarounds​

Add a post_install hook to your Podfile so every pod builds for at least your app's deployment target.

  1. Set your app's deployment target to iOS 15.0 or later, which Xcode 27 requires. Declare the same version in your Podfile with platform :ios. React Native's default Podfile already does this with min_ios_version_supported.
  2. Add the following hook to your Podfile. CocoaPods allows only one post_install block, so if your Podfile already has one, add these lines inside it. In React Native apps, keep the existing react_native_post_install(...) call and add the lines after it.
post_install do |installer|
# If this block already exists (for example, with react_native_post_install),
# keep its contents and add the lines below inside it.
project_settings = installer.pods_project.build_configurations.first.build_settings
%w[IPHONEOS_DEPLOYMENT_TARGET TVOS_DEPLOYMENT_TARGET WATCHOS_DEPLOYMENT_TARGET MACOSX_DEPLOYMENT_TARGET].each do |setting|
app_minimum = project_settings[setting]
next if app_minimum.nil?
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
pod_minimum = config.build_settings[setting]
next if pod_minimum.nil? || Gem::Version.new(pod_minimum) >= Gem::Version.new(app_minimum)
config.build_settings.delete(setting)
end
end
end
end
  1. Run pod install, then build your app again.

For each target in the Pods project with a deployment target lower than your app's, the hook removes the target's own value. The target then uses your app's deployment target. Pods that declare a higher minimum than your app keep their value, and no pod is raised above your app's deployment target.

Projects with a generated Podfile​

Some tools regenerate the Podfile, which overwrites any changes you make to it by hand:

  • Expo SDK 56 and earlier: npx expo prebuild regenerates the ios directory. Add the hook with a config plugin.
  • Unity: External Dependency Manager generates the Podfile. Install the iOS dependencies with Swift Package Manager instead, which isn't affected. See iOS dependency manager.
  • Cordova: cordova-ios generates the Podfile in platforms/ios. cordova prepare rewrites it and runs pod install before after_prepare hooks run, so use an after_prepare Cordova hook script that adds the post_install block to the Podfile and runs pod install again.

Expo SDK 57, Flutter 3.47 and later, and Capacitor 8 already apply an equivalent adjustment in their own Podfile tooling. On Expo SDK 57, make sure expo-modules-autolinking is 57.0.6 or later. If you use an earlier Flutter version, update Flutter or add the hook above to ios/Podfile.

Was this page helpful?