react-native: 'value' is unavailable: introduced in iOS 12.0

Description

‘value’ is unavailable: introduced in iOS 12.0

Version

0.69.0

Output of npx react-native info

System: OS: macOS 10.15.7 CPU: (4) x64 Intel® Core™ i7-3520M CPU @ 2.90GHz Memory: 27.26 MB / 8.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node Yarn: 1.22.10 - ~/.nvm/versions/node/v14.17.0/bin/yarn npm: 8.4.1 - ~/.nvm/versions/node/v14.17.0/bin/npm Watchman: 4.7.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: API Levels: 23, 25, 26, 27, 28, 29, 30 Build Tools: 26.0.2, 26.0.3, 28.0.3, 29.0.2, 29.0.3, 30.0.3 System Images: android-25 | Google APIs ARM EABI v7a, android-29 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.2 AI-202.7660.26.42.7351085 Xcode: 12.4/12D4e - /usr/bin/xcodebuild Languages: Java: 1.8.0_152 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.0 => 0.69.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

npx react-native init example --template react-native-template-typescript

yarn start

open xcode run

Snack, code example, screenshot, or link to a repository

image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 33
  • Comments: 99 (4 by maintainers)

Commits related to this issue

Most upvoted comments

In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj

Change all the ‘IPHONEOS_DEPLOYMENT_TARGET = 11.0’ to ‘IPHONEOS_DEPLOYMENT_TARGET = 12.4’. save and run.

Note: every time you pod install it will change so again you have to do it. If there is better approach please do mention.

Here’s how I fixed it:

  1. Open node_modules/react-native/scripts/react_native_pods.rb
  2. Go to line no 401 >>> 'ios' => '11.0',
  3. Change 11.0 to 12.0
  4. Use patch-package to make a patch.
  5. Run yarn
  6. Run pod install
  7. Go to ios/build/generated/ios/React-Codegen.podspec.json and confirm "platforms": { "ios": "12.0" }

That’s all.

diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index 7f6ebab..cea0fef 100644
--- a/node_modules/react-native/scripts/react_native_pods.rb
+++ b/node_modules/react-native/scripts/react_native_pods.rb
@@ -398,7 +398,7 @@ def get_react_codegen_spec(options={})
     'source' => { :git => '' },
     'header_mappings_dir' => './',
     'platforms' => {
-      'ios' => '11.0',
+      'ios' => '12.0',
     },
     'source_files' => "**/*.{h,mm,cpp}",
     'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>

@OmarUsman777

I think If you set like this in Podfile, you don’t have to change them manually everytime.

  ...
  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    # NOTE: Change IPHONEOS_DEPLOYMENT_TARGET to 12.4.
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
      end
    end
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end

Can confirm this happens in Xcode 14.3. I downloaded RC2 today and this issue started. I was able to solve it by the following:

  1. In your Xcode project navigator, select Pods.
  2. Under Targets, selectReact-Codegen and set the window to Build Settings.
  3. Under Deployment, set iOS Deployment Target to 12.4.
  4. Clean project and rebuild.

Update for version 0.70.3: If you want to follow advice from @ammarahm-ed , the property is in a different file now:

diff --git a/node_modules/react-native/scripts/cocoapods/codegen_utils.rb b/node_modules/react-native/scripts/cocoapods/codegen_utils.rb
index 6fcbb15..7e457b9 100644
--- a/node_modules/react-native/scripts/cocoapods/codegen_utils.rb
+++ b/node_modules/react-native/scripts/cocoapods/codegen_utils.rb
@@ -84,7 +84,7 @@ class CodegenUtils
           'source' => { :git => '' },
           'header_mappings_dir' => './',
           'platforms' => {
-            'ios' => '11.0',
+            'ios' => '12.0',
           },
           'source_files' => "**/*.{h,mm,cpp}",
           'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>

The second solution is:

  1. In the Xcode Project select “Pods”
  2. Select target that throws errors
  3. Select Build Settings
  4. Bump iOS Target to required version

But you should do this every time when project is updates

Screenshot 2023-06-15 at 12 29 01

👋 everyone!

We have just finished rolling out new patch releases for the versions in the release support window to address this problem, check them out:

They should address this problem fully.

The second solution is:

  1. In the Xcode Project select “Pods”
  2. Select target that throws errors
  3. Select Build Settings
  4. Bump iOS Target to required version

But you should do this every time when project is updates

Screenshot 2023-06-15 at 12 29 01

This simple solution worked for me

Hey folks, just an headsup: we already landed the change that fixes this correctly in https://github.com/facebook/react-native/pull/36759 and we are about to release the supported versions of React Native with their right fixes:

Expect them to land later this week.

4. Use patch-package to make a patch.

npx patch-package react-native

This solution worked for me with Xcode 14.3RC

https://stackoverflow.com/a/74487309

I fixed this by upgrading react-native from 0.71.4 to 0.71.11

👋 everyone!

We have just finished rolling out new patch releases for the versions in the release support window to address this problem, check them out:

* https://github.com/facebook/react-native/releases/tag/v0.71.6

* https://github.com/facebook/react-native/releases/tag/v0.70.8

* https://github.com/facebook/react-native/releases/tag/v0.69.9

They should address this problem fully.

This worked for me, after npm install, bundle install and pod install. Thanks kelset!

The second solution is:

  1. In the Xcode Project select “Pods”
  2. Select target that throws errors
  3. Select Build Settings
  4. Bump iOS Target to required version

But you should do this every time when project is updates

Screenshot 2023-06-15 at 12 29 01

You’ve saved my life. Hours upon hours of trying to fix it, and this did the trick.

This solution worked for me with Xcode 14.3RC

https://stackoverflow.com/a/74487309

image This worked like magic.

In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj

Change all the ‘IPHONEOS_DEPLOYMENT_TARGET = 11.0’ to ‘IPHONEOS_DEPLOYMENT_TARGET = 12.4’. save and run.

Note: every time you pod install it will change so again you have to do it. If there is better approach please do mention.

this was helpful my issue was resolved using this

if anybody with with react native 0.70 still facing this issue please upgrade to latest react native version 1.npx react-native upgrade 2. cd ios 3. pod install 4. Reopen xcode and build

Yup. Upgrading from 0.71.4 to 0.71.6 fixes this issue.

This is happening with Xcode Cloud when you have Xcode set to 14.3RC, if you change it to 14.2 you are good to go.

I wonder if this is due to changes in Swift 5.8.

Same issue here. I’m also using Xcode 12.4 - Could that be the reason?

Can confirm this happens in Xcode 14.3. I downloaded RC2 today and this issue started. I was able to solve it by the following:

1. In your Xcode project navigator, select `Pods`.

2. Under Targets, select`React-Codegen` and set the window to `Build Settings`.

3. Under Deployment, set `iOS Deployment Target` to `12.4`.

4. Clean project and rebuild.

This almost worked for me. I also had to update the build targets for react-native-quick-crypto and react-native-quick-base64. So if anyone relies on these dependencies as well, those need to be bumped.

@craspadotcom You have to add the postinstall script in package.json so it patches the files when you install/update packages.

"scripts": {
    "postinstall": "patch-package",
 
  },

The error occurs because React Native 0.69 targets ios 12.4 in Podfile but the Codegen generated podspec still targets ios 11.0 while using ios 12+ apis. I think there should be a patch release that fixes this issue.

Just had this issue and applying the change to all the pods didn’t cut it for me. So instead that’s what worked for me.

# Fix for use_frameworks! :linkage => :static
      react_native_post_install(installer)
      installer.pods_project.targets.each do |target|
        if target.name == 'RCT-Folly'
          target.build_configurations.each do |config|
            config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
          end
        end
--------> // added this
      # Change the deployment target to 12.4 for React-Codegen
        if target.name == 'React-Codegen'
          target.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
          end
        end
      end
<-------
      # __apply_Xcode_12_5_M1_post_install_workaround(installer)
      installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end

Here’s an expo config plugin that worked for me for managed Expo workflow (it updates the deployment target for all pods to 13.0)

/* eslint-disable @typescript-eslint/no-var-requires */
const { withDangerousMod, withPlugins } = require("@expo/config-plugins");
const {
  mergeContents,
} = require("@expo/config-plugins/build/utils/generateCode");
const fs = require("fs");
const path = require("path");

async function readFileAsync(path) {
  return fs.promises.readFile(path, "utf8");
}

async function saveFileAsync(path, content) {
  return fs.promises.writeFile(path, content, "utf8");
}

const withFixedDeploymentTarget = (c) => {
  return withDangerousMod(c, [
    "ios",
    async (config) => {
      const file = path.join(config.modRequest.platformProjectRoot, "Podfile");
      const contents = await readFileAsync(file);
      await saveFileAsync(file, fixDeploymentTarget(contents));
      return config;
    },
  ]);
};

function fixDeploymentTarget(src) {
  return mergeContents({
    tag: `rn-fix-deployment-target`,
    src,
    newSrc: `
   installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
               config.build_settings['SWIFT_VERSION'] = '5.0'
               config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
    end
  end
`,
    anchor: /post_install/,
    offset: 1,
    comment: "#",
  }).contents;
}

module.exports = (config) => withPlugins(config, [withFixedDeploymentTarget]);

Put this in “<project_root>/config-plugins/deployment-targets.js”

Then add to your app.json:

{
  "plugins": ["./config-plugins/deployment-targets"]
}

Then rm -rf ios => expo run:ios

  • change the pod files line number 31-37 as (comment this line) use_flipper!()

    post_install do |installer| react_native_post_install(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer) sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h end

  • search IPHONEOS_DEPLOYMENT_TARGET in the whole project and change to 12.4 for every pod as well

hope that works…

This issue was fixed for me by bumping react-native from 0.70.6 to 0.70.10, in order to get this fix: https://github.com/facebook/react-native/commit/c5e549e694607cd576be8fcb5ed909fec2ed6dce

So if you’re still on react-native 0.70.x, you can still get support for Xcode 14.3 using minor version 10.

It still happens with XCode 14.3.1 and RN 0.71.8 on several modules like : react-native-simple-toast, react-native-svg, react-native-permissions…

The problem started to pop in my project after updating XCode from 14.1 to 14.3.1.

@WyrdRaven did you remember to pod install after the upgrade? The fix needs to change a setting in the Pods xcodeproj file.

@iway1 This works for me, updating all the pods isn’t necessary

const { withDangerousMod, withPlugins } = require("@expo/config-plugins");
const { ExpoConfig } = require("@expo/config-types");
const {
  mergeContents,
} = require("@expo/config-plugins/build/utils/generateCode");
const { readFileSync, writeFileSync } = require("fs");
const { resolve } = require("path");

const withFixedDeploymentTarget = (c) => {
  return withDangerousMod(c, [
    "ios",
    async (config) => {
      const file = resolve(config.modRequest.platformProjectRoot, "Podfile");
      const contents = readFileSync(file, { encoding: "utf-8" });
      writeFileSync(file, fixDeploymentTarget(contents));
      return config;
    },
  ]);
};

function fixDeploymentTarget(src) {
  return mergeContents({
    tag: `rn-fix-deployment-target`,
    src,
    newSrc: `
  installer.pods_project.targets.each do |target|
    if target.to_s === 'React-Codegen'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '5.0'
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
      end
    end
  end
`,
    anchor: /post_install/,
    offset: 1,
    comment: "#",
  }).contents;
}

module.exports = (config) => withPlugins(config, [withFixedDeploymentTarget]);

Here is edit for only patching React-Codegen At least temporarily, I recommend this solution if using expo, manually editing the podfile isn’t optimal in the expo workflow

Can confirm this happens in Xcode 14.3. I downloaded RC2 today and this issue started. I was able to solve it by the following:

  1. In your Xcode project navigator, select Pods.
  2. Under Targets, selectReact-Codegen and set the window to Build Settings.
  3. Under Deployment, set iOS Deployment Target to 12.4.
  4. Clean project and rebuild.

Thank you, it works perfectly for me.

This is happening to me on XCode 14.2 as well since 2 days ago

image ![image](https://user-images.githubusercontent.com/5866002/229302367-fb09c4cf-11f9-4f01-b85f-d08ea12e3df3.png)

In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj

Change all the ‘IPHONEOS_DEPLOYMENT_TARGET = 11.0’ to ‘IPHONEOS_DEPLOYMENT_TARGET = 12.4’. save and run.

Note: every time you pod install it will change so again you have to do it. If there is better approach please do mention.

You saved my job man! I know this is because our old macs are not updating to the latest ios. Now i hope i earn enough to buy the new mac 😃

In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj

Change all the ‘IPHONEOS_DEPLOYMENT_TARGET = 11.0’ to ‘IPHONEOS_DEPLOYMENT_TARGET = 12.4’. save and run.

Note: every time you pod install it will change so again you have to do it. If there is better approach please do mention.

Thanks for this. After so many tries on how to resolve this issue, this is the one that worked. 🍻

just upgrade react native version to 0.72.3 and pod install fix it for me

@efecantekin try cleaning the build using CMD/CRTL+SHIFT+K on xcode and try add the pods again npx pod-install - this worked for me

Guys, don’t do anything fancy, just update to the latest minor version, delete pods, Podfile.lock, reinstall the pods with pod install --repo-update, and everything should work. See

@OmarUsman777

I think If you set like this in Podfile, you don’t have to change them manually everytime.

  ...
  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    # NOTE: Change IPHONEOS_DEPLOYMENT_TARGET to 12.4.
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
      end
    end
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end

@kouhot 's solution worked for me. Had to add this to Podfile and then Clean and run pod install again, and everything worked without error. Thanks kouhot!

https://stackoverflow.com/a/75915794/12105742

This solution works for me

thank you, it worked for me

👋 everyone! We have just finished rolling out new patch releases for the versions in the release support window to address this problem, check them out:

* https://github.com/facebook/react-native/releases/tag/v0.71.6

* https://github.com/facebook/react-native/releases/tag/v0.70.8

* https://github.com/facebook/react-native/releases/tag/v0.69.9

They should address this problem fully.

This worked for me, after npm install, bundle install and pod install. Thanks kelset!

Unfortunately this only fixed things for me for the React Native stuff. I guess I’ll have to make an issue on Quick Crypto to get them to fix the same issue.

In iOS Folder go to Pods/Pods.xcodeproj/xcuserdata/project.pbxproj

Change all the ‘IPHONEOS_DEPLOYMENT_TARGET = 11.0’ to ‘IPHONEOS_DEPLOYMENT_TARGET = 12.4’. save and run.

Note: every time you pod install it will change so again you have to do it. If there is better approach please do mention.

Thank you so much. You saved my day.

I have an Apple Macbook Pro M3 with Xcode 15.3. If anyone out there is unable to solve it, try this version: The IPHONEOS_DEPLOYMENT_TARGET should be 13.0. It should be more than 12.4.


target.build_configurations.each do |config|
  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
  if target.name == 'react-native-config'
    config.build_settings['ENVFILE'] = ENVFILES[config.name]
  end
  config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
end

diff --git a/node_modules/react-native/scripts/cocoapods/codegen_utils.rb b/node_modules/react-native/scripts/cocoapods/codegen_utils.rb
index 3694e68..caa9794 100644
--- a/node_modules/react-native/scripts/cocoapods/codegen_utils.rb
+++ b/node_modules/react-native/scripts/cocoapods/codegen_utils.rb
@@ -85,7 +85,7 @@ class CodegenUtils
           'source' => { :git => '' },
           'header_mappings_dir' => './',
           'platforms' => {
-            'ios' => '11.0',
+            'ios' => '12.4',
           },
           'source_files' => "**/*.{h,mm,cpp}",
           'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>

in “react-native”: “0.71.2”

npx patch-package react-native

this works! try this

    target.build_configurations.each do |config|
      if target.name == "React-Codegen"
        # https://github.com/facebook/react-native/issues/34106
        config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "12.4"
      end
    end

I found that the scalpel is better than the hammer. This is in ios/Podfile.

thanks everyone! Sounds like for RN the issue is addressed, if you have similar issues but in separate libraries please open issues and PRs to them directly!

downgrading to xcode 14.2 also working.

@OmarUsman777

I think If you set like this in Podfile, you don’t have to change them manually everytime.

  ...
  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    # NOTE: Change IPHONEOS_DEPLOYMENT_TARGET to 12.4.
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
      end
    end
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end

This worked on my project: “react”: “18.1.0”, “react-native”: “0.70.6”, XCode Version 14.3 MacBookAir M1 - MacOS Ventura 13.0

👋 everyone!

We have just finished rolling out new patch releases for the versions in the release support window to address this problem, check them out:

They should address this problem fully.

I tried to build RN 71.10 on XCode 14.3.1 and got this error again. I checked Codegen_utils.rb and it uses min_ios_version_supported definition which returns 12.4 already in react_native_pods.rb.

image

isn’t this solved already, i am facing the same issue?

Here’s how I fixed it:

  1. Open node_modules/react-native/scripts/react_native_pods.rb
  2. Go to line no 401 >>> 'ios' => '11.0',
  3. Change 11.0 to 12.0
  4. Use patch-package to make a patch.
  5. Run yarn
  6. Run pod install
  7. Go to ios/build/generated/ios/React-Codegen.podspec.json and confirm "platforms": { "ios": "12.0" }

That’s all.

diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index 7f6ebab..cea0fef 100644
--- a/node_modules/react-native/scripts/react_native_pods.rb
+++ b/node_modules/react-native/scripts/react_native_pods.rb
@@ -398,7 +398,7 @@ def get_react_codegen_spec(options={})
     'source' => { :git => '' },
     'header_mappings_dir' => './',
     'platforms' => {
-      'ios' => '11.0',
+      'ios' => '12.0',
     },
     'source_files' => "**/*.{h,mm,cpp}",
     'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>

When i i have try this soultion then i am getting this error lol now do i fixed this issues i think your solution does’t work for me it is creating another problem, i guess everyone getting the same issues after trying your solutions like this Screenshot 2023-06-07 at 2 30 16 PM i am totally fed -up with your solution pls someone suggest me another solution accepting this one

https://stackoverflow.com/a/75915794/12105742

This solution works for me

Thank’s, it worked

Here’s how I fixed it:

  1. Open node_modules/react-native/scripts/react_native_pods.rb
  2. Go to line no 401 >>> 'ios' => '11.0',
  3. Change 11.0 to 12.0
  4. Use patch-package to make a patch.
  5. Run yarn
  6. Run pod install
  7. Go to ios/build/generated/ios/React-Codegen.podspec.json and confirm "platforms": { "ios": "12.0" }

That’s all.

diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index 7f6ebab..cea0fef 100644
--- a/node_modules/react-native/scripts/react_native_pods.rb
+++ b/node_modules/react-native/scripts/react_native_pods.rb
@@ -398,7 +398,7 @@ def get_react_codegen_spec(options={})
     'source' => { :git => '' },
     'header_mappings_dir' => './',
     'platforms' => {
-      'ios' => '11.0',
+      'ios' => '12.0',
     },
     'source_files' => "**/*.{h,mm,cpp}",
     'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>

The same issue happened to me in new Xcode 14.3. That’s save me! Thanks! ❤️

This solution worked for me with Xcode 14.3RC

https://stackoverflow.com/a/74487309

This work for me

To anyone that keeps having these issues and is using XcodeCloud, make sure to go to the workflow settings and choose the correct environment. In my case it was using the latest environment (14.3RC at the moment) and that was breaking everything. I selected spewcifically 14.2 and multiple things got fixed.

+1

I’m getting this on a brand RN new project following the Getting Started instructions. Seems pretty ridiculous we’d have to modify one of the node_module files.