react-native: Unable to build with XCode 14.0

Description

XCode 14.0 is released since yesterday, and I have the following error while building a fresh app on a physical device:

[...]/ios/Pods/Pods.xcodeproj error project: Signing for "React-Core-AccessibilityResources" requires a development team. Select a development team in the Signing & Capabilities editor.

Is react-native ready for XCode 14?

Version

0.70.0

Output of npx react-native info

System: OS: macOS 12.5.1 CPU: (10) arm64 Apple M1 Pro Memory: 6.53 GB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node Yarn: Not Found npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm Watchman: 2022.08.29.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: 14.0/14A309 - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.0 => 0.70.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

  • Create a fresh react-native app with npx react-native init MyApp
  • Open XCode and try to build the app on a real device

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

https://github.com/BeTomorrow/react-native-file-logger/tree/master/example Capture d’écran 2022-09-13 à 12 53 28

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 54
  • Comments: 40 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I use this script and it works

Hey Everyone! I was able to find a solution! It’s honestly much simpler than I thought.

I believe the bug must have gotten introduced in XCode 14 and it was not setting a development team for the iOS pod named “React-Core-AccessibilityResources”. This was stopping me from being able to build my app on my IPhone and likely would have stopped me from being able to archive my build to get it on the App Store.

Solution:

When you see this message: Screen Shot 2022-10-09 at 8 42 15 PM

The MISTAKE I was making was trying to go to my AppName -> Signing & Capabilities. This message is trying to tell you the error is within this specific POD.

All you have to do is

  1. Double click on the red text of the message. This is equivalent to clicking on “Pods” in the root folder. NOT the Pods folder of your AppName. Screen Shot 2022-10-09 at 8 45 47 PM
  2. Double Clicking on the red message will take you straight to the specific Pod, otherwise, click Root level Pods folder then scroll in the nav bar to “React-Core-AccessibibilityResources”
Screen Shot 2022-10-09 at 8 50 13 PM
  1. Here you will see the issue: Screen Shot 2022-10-09 at 8 52 59 PM

Select your team of choice and move on with your day!

xcode downgrade 13.4.1 version.

My workaround was to specify the TEAM_ID, my lines looks like this:

post_install do |installer|
  react_native_post_install(installer)
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
  # Add these lines for Xcode 14 builds
  installer.generated_projects.each do |project|
    project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings["DEVELOPMENT_TEAM"] = "TEAM_ID"
        end
    end
  end
  # End of added lines
end

I hope it helps!

How can I merge with that script?

Replace with this

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    installer.pods_project.targets.each do |target|
      if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
        target.build_configurations.each do |config|
            config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end
    end
  end

I solved this problem select development team.

hey folks, we have released a fix for this in 0.70.3 - please update to this new version: https://github.com/facebook/react-native/releases/tag/v0.70.3

can you folks try this workaround? https://github.com/expo/expo/commit/d970a9ecbb15b554b6fa23e8d43006fd15152028

it’s the one the Expo team has been implementing and it seems to be in line with some comments in the pods issue.

Downgrade is not a real solution, only a quick fix.

My workaround was to specify the TEAM_ID, my lines looks like this:

post_install do |installer|
  react_native_post_install(installer)
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
  # Add these lines for Xcode 14 builds
  installer.generated_projects.each do |project|
    project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings["DEVELOPMENT_TEAM"] = "TEAM_ID"
        end
    end
  end
  # End of added lines
end

I hope it helps!

Worked perfectly thanks!

If anyone else isn’t sure where to get his team ID, it can be found on the apple developer website https://developer.apple.com/account/#/membership under the menu “Certificates, Identifiers & Profiles” and then look at the top right under your account name.

I tried adding the fix mentioned here to the Podfile, and it worked locally.

But on the CI running on App Center for release builds, I am now getting this error: /Users/runner/work/1/s/ios/Pods/Pods.xcodeproj: error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "XXX" with a private key was found. (in target 'React-Core-AccessibilityResources' from project 'Pods')

Any ideas about that?

@ucheNkadiCode this works only until you do pod install the next time.

just as an headsup, we have a PR getting merged with a fix that we think is the right level of “scope”: https://github.com/facebook/react-native/pull/34826 it will get cherry picked for the next 0.70 release

I also tried to compile the application in “any device” mode (so not specifically for a physical device), and I get the same error in XCode 14.

Manually selecting a team for this pod seems to solve the problem. However, I am not sure if this workaround has any side effects.

I tried setting the team manually and was able to build the app. But somehow the globals declared in babel.config.js failed with ReferenceError: Can't find variable: <variable_name>. I had this issue with __scanCodes from https://github.com/rodgomesc/vision-camera-code-scanner.

As expected reverting XCode to version 13.4.1 fixed all of the above.

hey folks, we have released a fix for this in 0.70.3 - please update to this new version: https://github.com/facebook/react-native/releases/tag/v0.70.3

I have a problem with this new release unless @kelset can answer. For new version 70.3, the solution involves turning off code signing for all React-Core packages. What does that do and how does it affect publishing to App Store?

Thank you

Incidentally, what seems to have made a difference is upgrading Cocoapods to 1.12.0. To be clear we did not add any of the workarounds in the Pod file post_install hooks as described earlier.

Yes, Cocoapods 1.12.0 contains a fix for this issue (although it was missing from the release notes): https://github.com/CocoaPods/CocoaPods/commit/141a082a3fda27e73fe7b32bd999eac53b44cf12

From https://github.com/facebook/react-native/issues/34673#issuecomment-1245445193. What does CODE_SIGNING_ALLOWED do? Isn’t it needed?

thank you @tomwanzek for checking!

Sorry, forgot to give update here, yes, it’s indeed something wrong with our app, i documented the problem and solution here: https://github.com/CocoaPods/CocoaPods/issues/11402#issuecomment-1489846509

In case someone has the same problem.

@kelset That workaround works for me.

I found out this script actually works on my CI, just this doesn’t.

When implementing this fix, I am getting the following error: “undefined method `react_native_post_install’ for #Pod::Podfile:0x00007fea76758c18”

Is there something else we have to do to get that method to work?

Thanks in advance!