Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Cocoapods for Xcode 14.3.0 #36759

Closed
wants to merge 1 commit into from

Conversation

cipolleschi
Copy link
Contributor

Summary:
On Thursday the 30th, Apple Released Xcode 14.3.0.
This Version of Xcode enforce some version checks for which React-Codegen, which supported iOS 11 as minimum supported version, could not be build anymore.

This change ensue that React-Codegen is always aligned to the min version supported by React Native.
Plus, it moves CircleCI's Xcode to 14.3.0, to keep this problem in Check.

While working on this, I figured that, with the monorepo, Ruby tests stopped working because they were in the wrong folder: I moved them in the right one.

Changelog:

[iOS][Fixed] - Make React Native build with Xcode 14.3.0 and fix tests

Differential Revision: D44605617

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Apr 1, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44605617

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,569,009 +0
android hermes armeabi-v7a 7,883,400 +0
android hermes x86 9,050,927 +0
android hermes x86_64 8,905,954 +0
android jsc arm64-v8a 9,167,731 +0
android jsc armeabi-v7a 8,358,132 +0
android jsc x86 9,224,398 +0
android jsc x86_64 9,482,236 +0

Base commit: a2d2696
Branch: main

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Apr 1, 2023
Summary:
Pull Request resolved: facebook#36759

On Thursday the 30th, Apple Released Xcode 14.3.0.
This Version of Xcode enforce some version checks for which React-Codegen, which supported iOS 11 as minimum supported version, could not be build anymore.

This change ensue that React-Codegen is always aligned to the min version supported by React Native.
Plus, it moves CircleCI's Xcode to 14.3.0, to keep this problem in Check.

While working on this, I figured that, with the monorepo, Ruby tests stopped working because they were in the wrong folder: I moved them in the right one.

## Changelog:
[iOS][Fixed] - Make React Native build with Xcode 14.3.0 and fix tests

Differential Revision: D44605617

fbshipit-source-id: e634c70607767ef9a2af08848bce9407b66a3431
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44605617

@@ -527,7 +535,7 @@ def get_podspec_no_fabric_no_script
'source' => { :git => '' },
'header_mappings_dir' => './',
'platforms' => {
'ios' => '11.0',
'ios' => '12.4',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn’t it be also min_ios_version_supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it depends on the philosophy you adopt to write tests.
If you use min_ios_version_supported here, once we move the function to the proper file and we reuse the same function of production, this test would be tautological, as changing what the function in prod returns will also change what returned here.

Personally, I prefer to see my test failing if I bump a version in production code, so I can double check that the change was done on purpose and not by mistake. That's why I hardcoded the value.

Does it make sense?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting – makes sense!

@LukeIKG
Copy link

LukeIKG commented Apr 1, 2023

hey I'm new to developing. my react native project stopped working because of the xcode update. so my question is where do i look for updates? do i need to wait for an xcode update? Cocoapods update? I don't really understand what's happening.

Thanks for your help!

@Jonatthu
Copy link

Jonatthu commented Apr 1, 2023

@LukeIKG you need to wait until this gets merged or apply the changes manually with patch or downgrade your Xcode to 14.2

@LukeIKG
Copy link

LukeIKG commented Apr 1, 2023

@LukeIKG you need to wait until this gets merged or apply the changes manually with patch or downgrade your Xcode to 14.2

Thanks for the quick response!
This means I'll wait for a new release and then update my package.json (at "react-native": "0.71.4",) and run npm install -> pod install?

@cipolleschi
Copy link
Contributor Author

So, the root cause is that one of our pods (React-Codegen) is supporting iOS 11, which does not build with Xcode 14.3.

This change bumps the above mentioned pod, fixing the problem.

When the patch is out, yes, you'll have to bump RN in the package.json, apply the changes suggested here and then yarn && cd ios && bundle exec pod install - we suggest to use Ruby Bundler to install your dependencies as it makes sure to use the right version of Cocoapods. If you never used it before, the first time you need to run also bundle install inside the iOS folder. You need to run bundle install only once per project

Meanwhile, you can use the "patch" suggested here

Or, I think, use Xcode 14.2 toolchain with Xcode 14.3, or downgrade Xcode to 14.2.

@LukeIKG
Copy link

LukeIKG commented Apr 2, 2023

So, the root cause is that one of our pods (React-Codegen) is supporting iOS 11, which does not build with Xcode 14.3.

This change bumps the above mentioned pod, fixing the problem.

When the patch is out, yes, you'll have to bump RN in the package.json, apply the changes suggested here and then yarn && cd ios && bundle exec pod install - we suggest to use Ruby Bundler to install your dependencies as it makes sure to use the right version of Cocoapods. If you never used it before, the first time you need to run also bundle install inside the iOS folder. You need to run bundle install only once per project

Meanwhile, you can use the "patch" suggested here

Or, I think, use Xcode 14.2 toolchain with Xcode 14.3, or downgrade Xcode to 14.2.

Got it to work, yay!
Thanks a lot for clarifying the procedure - really helpful

Summary:
Pull Request resolved: facebook#36759

On Thursday the 30th, Apple Released Xcode 14.3.0.
This Version of Xcode enforce some version checks for which React-Codegen, which supported iOS 11 as minimum supported version, could not be build anymore.

This change ensue that React-Codegen is always aligned to the min version supported by React Native.
Plus, it moves CircleCI's Xcode to 14.3.0, to keep this problem in Check.

While working on this, I figured that, with the monorepo, Ruby tests stopped working because they were in the wrong folder: I moved them in the right one.

## Changelog:
[iOS][Fixed] - Make React Native build with Xcode 14.3.0 and fix tests

Reviewed By: blakef

Differential Revision: D44605617

fbshipit-source-id: 182bad20fff2bc19f900000560152369013bb481
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44605617

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Apr 2, 2023
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in cb88e75.

@Jackyeoh
Copy link

Jackyeoh commented Apr 3, 2023

So, the root cause is that one of our pods (React-Codegen) is supporting iOS 11, which does not build with Xcode 14.3.

This change bumps the above mentioned pod, fixing the problem.

When the patch is out, yes, you'll have to bump RN in the package.json, apply the changes suggested here and then yarn && cd ios && bundle exec pod install - we suggest to use Ruby Bundler to install your dependencies as it makes sure to use the right version of Cocoapods. If you never used it before, the first time you need to run also bundle install inside the iOS folder. You need to run bundle install only once per project

Meanwhile, you can use the "patch" suggested here

Or, I think, use Xcode 14.2 toolchain with Xcode 14.3, or downgrade Xcode to 14.2.

For devs working with older versions of react-native (am working with 0.70.6) looking to apply the "patch", looks like we need to define min_ios_version_supported ourselves. The patch then looks like the following:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

$min_ios_version_supported = 12.4

platform :ios, $min_ios_version_supported
install! 'cocoapods', :deterministic_uuids => false

# Force pods to match minimum iOS version for React Native
# Fixes build issue on Xcode Cloud where some pods
# Use iOS 12 calls despite being set as iOS 11
def __apply_Xcode_14_3_RC_post_install_workaround(installer)
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      current_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
      minimum_target = $min_ios_version_supported
      if current_target.to_f < minimum_target.to_f
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_target
      end
    end
  end
end

kelset pushed a commit that referenced this pull request Apr 3, 2023
Summary:
Pull Request resolved: #36759

On Thursday the 30th, Apple Released Xcode 14.3.0.
This Version of Xcode enforce some version checks for which React-Codegen, which supported iOS 11 as minimum supported version, could not be build anymore.

This change ensue that React-Codegen is always aligned to the min version supported by React Native.
Plus, it moves CircleCI's Xcode to 14.3.0, to keep this problem in Check.

While working on this, I figured that, with the monorepo, Ruby tests stopped working because they were in the wrong folder: I moved them in the right one.

## Changelog:
[iOS][Fixed] - Make React Native build with Xcode 14.3.0 and fix tests

Reviewed By: blakef

Differential Revision: D44605617

fbshipit-source-id: 3ec1f5b36858ef07d9f713d74eb411a1edcccd45
@Shakahs

This comment was marked as abuse.

@guilepaul
Copy link

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

@flochtililoch
Copy link

I'm a little confused with this statement:

the root cause is that one of our pods (React-Codegen) is supporting iOS 11, which does not build with Xcode 14.3

Xcode 14.3 can build for iOS 11, so I assume that there's some code in React-Codegen that does not play nice with Xcode 14.3 and that it somewhat relates to iOS 11 support.

@cipolleschi could you provide more clarity on what is causing the build issues?

I'm currently running an older RN version (0.67.4), which does have a minimum iOS target version of 11. I'd like to know if bumping it to 12.4 is the only viable solution right now to be able to build with Xcode 14.3

jeongshin pushed a commit to jeongshin/react-native that referenced this pull request May 7, 2023
Summary:
Pull Request resolved: facebook#36759

On Thursday the 30th, Apple Released Xcode 14.3.0.
This Version of Xcode enforce some version checks for which React-Codegen, which supported iOS 11 as minimum supported version, could not be build anymore.

This change ensue that React-Codegen is always aligned to the min version supported by React Native.
Plus, it moves CircleCI's Xcode to 14.3.0, to keep this problem in Check.

While working on this, I figured that, with the monorepo, Ruby tests stopped working because they were in the wrong folder: I moved them in the right one.

## Changelog:
[iOS][Fixed] - Make React Native build with Xcode 14.3.0 and fix tests

Reviewed By: blakef

Differential Revision: D44605617

fbshipit-source-id: 3ec1f5b36858ef07d9f713d74eb411a1edcccd45
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
Pull Request resolved: facebook#36759

On Thursday the 30th, Apple Released Xcode 14.3.0.
This Version of Xcode enforce some version checks for which React-Codegen, which supported iOS 11 as minimum supported version, could not be build anymore.

This change ensue that React-Codegen is always aligned to the min version supported by React Native.
Plus, it moves CircleCI's Xcode to 14.3.0, to keep this problem in Check.

While working on this, I figured that, with the monorepo, Ruby tests stopped working because they were in the wrong folder: I moved them in the right one.

## Changelog:
[iOS][Fixed] - Make React Native build with Xcode 14.3.0 and fix tests

Reviewed By: blakef

Differential Revision: D44605617

fbshipit-source-id: 3ec1f5b36858ef07d9f713d74eb411a1edcccd45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.