skip to Main Content

I just upgraded from RN 0.68.x to 0.69.0 using the react-native upgrade command.Its shows an error about
FBReactNativeSpec
‘value’ is unavailable : introduced in ios 12.0 react native

and same error shown when i create a new project with latest version.

xcode:12.4
macVersion:10.15.7

enter image description here

enter image description here

12

Answers


  1. I think this is caused by some pods in your react-native project that are not the latest version and as a result some of may have IPHONEOS_DEPLOYMENT_TARGET less than 12.0

    In my case I did the following steps

    • In VS Code i did a search for IPHONEOS_DEPLOYMENT_TARGET i could see that in the ios/Pods/Pods.xcodeproj/project.pbxproj file a few pods had target version less then 12.0 I updated them to 12.4 (This step i feel can be sorted by updating your packages to the latest and re-run pod install/update but I had some packages that the latest update did not change it for me)
    • Under XCode top menu, Goto XCode->Preferences -> Locations -> Open
      Derived Data folder(By clicking the arrow button)
    • Finder will open Derived Data folder
    • Delete Derived Data Folder
    • Start Metro server using npm start or yarn start
    • In Xcode, perform Clean build using cmd+shift+k
    • In Xcode, run the application using cmd+r
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
  3. Following up on Azaz Answer

    You can automate it for all the build configurations
    in your podfile

    add

    post_install do |installer|
       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'] = '12.4'
           end
       end
    end
    
    Login or Signup to reply.
    1. Open the project in XCode.
    2. Pods>React-Codegen
    3. Change the target version from 11.0 to 12.x.
    4. Build.

    Update from React Native Community (I didn’t tried to upgrade yet): https://github.com/facebook/react-native/issues/34106#issuecomment-1495970568

    Login or Signup to reply.
  4. I know this is solved but if anyone wants a solution using only expo (I’m a big expo fanboy right now)

    Heres how you can modify the podfile like in Vivek’s answer using an expo config plugin.

    I also added an if statment to only update React-codegen because it was the only one giving me issues after updating xcode to 14.3

    // ./expo-plugins/fix-rn-codegen.js
    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]);
    

    Then link it in app.json

    // ./app.json
    {
      "expo": {
        "plugins": [
          ["./expo-plugins/fix-rn-codegen.js"]
        ]
      }
    }
    
    Login or Signup to reply.
  5. It started happening after upgrading to the latest Xcode few days back.

    1. In 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.

    That’s a big discussion on https://github.com/facebook/react-native/issues/34106 regarding this issue.

    Login or Signup to reply.
  6. Illustrated answer for those who might have a hard time finding the options:

    1. In your Xcode project navigator, select Pods.
    2. Under Targets, select React-Codegen
    3. Set the window to Build Settings
    4. Under Deployment, set iOS Deployment Target to 12.4
    5. Clean project and rebuild: Product > Clean Build Folder, Product > Build

    Source: https://github.com/facebook/react-native/issues/34106#issuecomment-1489549051

    enter image description here

    Login or Signup to reply.
    1. Open the project in Xcode.
    2. open Pods.
    3. then find and select "React-Codegen" pod in target section.
    4. Change the target version from 11 to 12.
    5. And build again the project.
    Login or Signup to reply.
  7. Following Vivek Verma answer.

    Just prevent overriding Pods with a higher targets(new Expo pods have target 13).

    ios/Podfile

    // ios/Podfile
    post_install do |installer|
    ...
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['SWIFT_VERSION'] = '5.0'
          if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] < '12.4'
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
          end
        end
      end
    ...
    end
    
    
    Login or Signup to reply.
  8. I’ve spent hours going through solutions with no luck. I finally got it working by doing the following:

    1. Open workspace in Xcode
    2. Go to Pods -> React-Codegen -> Build Settings -> Deployment -> iOS Deployment Target
    3. Change the Target version to a later version

    In my case, it was on set to 11.0. I changed the target to 12.4 and it resolved the issue.

    I hope this helps.

    Login or Signup to reply.
  9. This has been fixed in the latest versions of react-native. You should be able to solve the problem by upgrading to any of these versions:

    Login or Signup to reply.
  10. Go to:
    /node_modules/react-native/scripts/cocoapods/codegen_utils.rb

    And change the version. From 11 to 12.

    --- 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" =>
    

    Finally run pod update.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search