react-native: Build fails on Xcode 14.3 RC

Description

Xcode Cloud now offers and appears to auto-select Xcode 14.3 Release Candidate for builds. This trips an iOS versioning bug. This is the relevant error section:

=== BUILD TARGET React-Codegen OF PROJECT Pods WITH CONFIGURATION Release === 2s Passed Make symlink libReact-Codegen.a 0s Passed Write all-product-headers.yaml 0s Passed Write React-Codegen.hmap 0s Passed Write React-Codegen-project-headers.hmap 0s Passed Write React-Codegen-own-target-headers.hmap 0s Passed Write React-Codegen-generated-files.hmap 0s Passed Write React-Codegen-all-target-headers.hmap 0s Passed Write React-Codegen-all-non-framework-target-headers.hmap 0s Passed Write React-Codegen.LinkFileList (arm64) 0s Passed Compile React-Codegen-dummy.m (arm64) 0s Error Compile FBReactNativeSpec-generated.mm (arm64) 2s Error ‘value’ is unavailable: introduced in iOS 12.0 Error ‘value’ is unavailable: introduced in iOS 12.0 Error ‘value’ is unavailable: introduced in iOS 12.0 Error ‘value’ is unavailable: introduced in iOS 12.0 Error ‘value’ is unavailable: introduced in iOS 12.0 Error ‘value’ is unavailable: introduced in iOS 12.0 Error ‘value’ is unavailable: introduced in iOS 12.0

So, the error is that react-native’s minimum version is iOS 12.4 but many pods are getting set to 11.0. The surface answer is to patch the projects, but the underlying problem is get_react_codegen_spec uses a hardcoded ‘11.0’ rather than ‘12.4’ or min_ios_version_supported defined in react_native_pods.rb.

React Native Version

0.71.4

Output of npx react-native info

NOTE: This is from my local machine. I am working on getting npx react-native info output from the build machine on Xcode Cloud.

info Fetching system and libraries information… System: OS: macOS 13.2.1 CPU: (10) arm64 Apple M1 Max Memory: 707.53 MB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.5.0 - /opt/homebrew/bin/node Yarn: Not Found npm: 9.3.1 - /opt/homebrew/bin/npm Watchman: 2023.02.20.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9477386 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 19.0.2 - /opt/homebrew/opt/openjdk/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: ^0.71.4 => 0.71.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

Create a sample project and connect to Xcode Cloud in App Store Connect. Run workflow on Xcode 14.3 RC.

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

https://github.com/travis-mark/lrn

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 36
  • Comments: 47 (4 by maintainers)

Commits related to this issue

Most upvoted comments

I posted a workaround to the sample project:

https://github.com/travis-mark/lrn/commit/015854716feadd61a904d5a603b027426472f863

The underlying issue should probably be addressed in react-native directly, but I’m less familiar with patching those files directly.

There is an easy fix with CocoaPod. Inside your Podfile change the iOS Deployment Target for the specific package

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
  )
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
  installer.pods_project.targets.each do |target|
    if target.name == "React-Codegen"
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
      end
    end
  end
end

Im having the same issue but Im not in a Mac. Im using Expo, so whenever I run Expo Start and run the react native app I get:

` None of these files exist:

  • node_modules\react-native\Libraries\Components\DatePicker\DatePickerIOS(.native|.native.ts|.ts|.native.tsx|.tsx|.native.js|.js|.native.jsx|.jsx|.native.json|.json)
  • node_modules\react-native\Libraries\Components\DatePicker\DatePickerIOS\index(.native|.native.ts|.ts|.native.tsx|.tsx|.native.js|.js|.native.jsx|.jsx|.native.json|.json) 15 | import typeof ActivityIndicator from ‘./Libraries/Components/ActivityIndicator/ActivityIndicator’; 16 | import typeof Button from ‘./Libraries/Components/Button’;

17 | import typeof DatePickerIOS from ‘./Libraries/Components/DatePicker/DatePickerIOS’; | ^ 18 | import typeof DrawerLayoutAndroid from ‘./Libraries/Components/DrawerAndroid/DrawerLayoutAndroid’; 19 | import typeof FlatList from ‘./Libraries/Lists/FlatList’; 20 | import typeof Image from ‘./Libraries/Image/Image’;`

Any clue?

after upgrading xcode to latest version 14.3 and sdk 16.4 this problem start appearing i fix it by changing IOS development for pods (react-codegen) from 11.0 to latest 12.4 run the app using command and it get fixed.

Screenshot 2023-05-03 at 7 19 56 PM

Fox expo user, just delete the iOS folder, and do a new build. It will automatically change the react-native version to the patched version, eg. 0.70.8.

I am using expo but do not see iOS folder I currently build with eas, pleas help.

Ok, this is how I “solved” it for now:

The easier and fastest way to avoid this until the fix is not there is to downgrade the version of your XCode back to 14.2.

Ya’ll can do this downloading it from here and moving to the applications folder. You might need to run the project from XCode before going back to cli

Just change min_ios_version_supported in Xcode for 12.4 Captura de Tela 2023-04-03 às 15 24 23

There’s a minimum fix that should land next week for 0.69.9, 0.70.8, 0.71.6 and 0.72-RC1.

I posted a workaround to the sample project:

travis-mark/lrn@0158547

The underlying issue should probably be addressed in react-native directly, but I’m less familiar with patching those files directly.

@travis-mark Do we anything need to change in xcode to use the workaround

Because, I get this after pod install in ios directory

Ignoring ffi-1.15.5 because its extensions are not built. Try: gem pristine ffi --version 1.15.5

[!] Invalid Podfile file: undefined local variable or method `min_ios_version_supported’ for #Pod::Podfile:0x00007fd75bcfdc00.

We were using react-native@69.* and only updating to 69.9 did not fix the issue. The only fix that helped was adding -no-verify-emitted-module-interface flag in Podfile:

  installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
          config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['$(inherited)', '-no-verify-emitted-module-interface']
      end

I couldn’t get the workaround working because react-native-skia has issues when building the project

There is an easy fix with CocoaPod. Inside your Podfile change the iOS Deployment Target for the specific package

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
  )
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
  installer.pods_project.targets.each do |target|
    if target.name == "React-Codegen"
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
      end
    end
  end
end

Just a quick note, if you’re new. Make sure to reinstall pods.

In your project root

cd ios && pod install

After applying the workaround from tavis-mark I had a very strange issue where the pods frameworks script would fail to copy the framework files when archiving a build (building worked fine). Turns out readlink would produce an invalid path and that’s why it failed.

I had to modify ios/Pods/Target Support Files/Pods-projectname/Pods-projectname-frameworks.sh and change

if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink "${source}")"
fi

to

if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink -f "${source}")"
fi

after that archiving worked again.

I have updated expo to 47.0.14, react-native to 0.70.8, deleted node_modules/, ran npm install, ran npx expo prebuild --clean and npx expo start -c as suggested in the previous comments. I run the expo cli on a Windows machine and connect to it with the Expo Go app v2.28.9 on my iPhone 14 Pro running iOS 16.4.1 (a) I’m still getting the error… My package.json dependencies I’d appreciate any advice, thanks.

Me too… Do you it achieved the fix?

@Santosl2 I ended up just updating to Expo v48. I guess there’s a fix in one of the versions in between but not sure which. If you’re unable to move to 48, perhaps you could try the last version of Expo 47.

There is an easy fix with CocoaPod. Inside your Podfile change the iOS Deployment Target for the specific package

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
  )
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
  installer.pods_project.targets.each do |target|
    if target.name == "React-Codegen"
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4'
      end
    end
  end
end

This is working for me.

I posted a workaround to the sample project: travis-mark/lrn@0158547 The underlying issue should probably be addressed in react-native directly, but I’m less familiar with patching those files directly.

@travis-mark Do we anything need to change in xcode to use the workaround

Because, I get this after pod install in ios directory

Ignoring ffi-1.15.5 because its extensions are not built. Try: gem pristine ffi --version 1.15.5

[!] Invalid Podfile file: undefined local variable or method `min_ios_version_supported’ for #Pod::Podfile:0x00007fd75bcfdc00.

@travis-mark can you confirm, please?

I posted a workaround to the sample project:

travis-mark/lrn@0158547

The underlying issue should probably be addressed in react-native directly, but I’m less familiar with patching those files directly.

You are an absolute legend! Thank you