stripe-react-native: pod install is giving a minimum deployment target error when my app is set up correctly with iOS 13 as the min deployment target

Describe the bug When running pod install on my iOS project, after installing the stripe react native package with yarn, I am getting an error “Specs satisfying the stripe-react-native (from …/node_modules/@stripe/stripe-react-native) dependency were found, but they required a higher minimum deployment target.” but my minimum deployment target is iOS 13 as specified in the documentation.

To Reproduce Steps to reproduce the behavior:

  1. Create a new React Native project (I’m using the latest v0.71.1 of react native) without expo.
  2. Run yarn install @stripe/stripe-react-native
  3. Run cd ios && pod install
  4. This is where I receive the error.

Expected behavior The package should be installed without issues.

Desktop (please complete the following information):

  • OS: [e.g. iOS] iOS build running on Mac Mini M1 2020. Tried this with XCode 14 and also upgraded to 14.2 but with the same result.

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] iPhone 11 Pro Max
  • OS: [e.g. iOS8.1] iOS 16.2

Additional context I’m migrating all my code from a RN 0.68.5 project into a new 0.71.1 project. I’ve started off by setting up the build schemes and installing dependencies in the application. There is quite a list of dependencies and all of them have gone fine except for this one. I tried installing the same version as the one that I had installed in my previous RN application, which was @stripe/stripe-react-native@0.21.0, but that actually gave me the same error as the latest version. I then tried increasing my deployment target on the iOS app to iOS 14 and 15 and 16 and each of them failed with the same error.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16

Most upvoted comments

@hussainarthuna The variable is defined here: node_modules/react-native/scripts/react_native_pods.rb

Lines 29 to 31 for me:

# This function returns the min iOS version supported by React Native
# By using this function, you won't have to manualy change your Podfile
# when we change the minimum version supported by the framework.
def min_ios_version_supported
  return '12.4'
end

Unfortunately I don’t know much ruby if it’s possible to override a variable definition in our own Podfile.

Solution that doesn’t require modifying your node_modules.

Add the following (before # existing code) to your Podfile

MIN_IOS_OVERRIDE = '13.0'
if Gem::Version.new(MIN_IOS_OVERRIDE) > Gem::Version.new(min_ios_version_supported)
    min_ios_version_supported = MIN_IOS_OVERRIDE
end
# existing code
platform :ios, min_ios_version_supported

TODO: Pull the highest IPHONEOS_DEPLOYMENT_TARGET from your project.pbxproj instead of MIN_IOS_OVERRIDE

In case anyone would like the code to read from the IPHONEOS_DEPLOYMENT_TARGET from the proj file

#######
# Read min iOS version from Xcode project and set as min iOS version for Podfile
require 'xcodeproj'

project_path = './MyApp.xcodeproj'
project = Xcodeproj::Project.open(project_path)
min_ios_version_supported = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
######

platform :ios, min_ios_version_supported

HI @MDG-MMeksasi,

It was included at the top of my podfile as follows:

image

But there was no definition for the variable. I replaced the variable with 13.0 as follows and it worked:

image

That’s actually strange, thanks for pointing that out. I didn’t create that variable - must be something new in RN. I changed it to 13.0 and it’s installed now!

Thank you for your help 😃

For the record, I thought that by adjusting the deployment version in XCode that it would update the podfile, and that the variable referenced was being updated accordingly. Seems that that isn’t the case though!

thanks! and where do you define min_ios_version_supported?