cli: Build fails to install when using the iOS 14 SDK

Environment

$ y react-native info
info Fetching system and libraries information...
System:
    OS: macOS 10.16
    CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
    Memory: 428.42 MB / 16.00 GB
    Shell: 5.8 - /usr/local/bin/zsh
  Binaries:
    Node: 14.4.0 - /private/var/folders/5w/5dc75xj91xx_mvq7prvkplx80000gn/T/xfs-f9519a63/node
    Yarn: 2.0.0-rc.33 - /private/var/folders/5w/5dc75xj91xx_mvq7prvkplx80000gn/T/xfs-f9519a63/yarn
    npm: 6.14.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /usr/local/lib/ruby/gems/2.7.0/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.0, DriverKit 20.0, macOS 10.16, tvOS 14.0, watchOS 7.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6514223
    Xcode: 12.0/12A6159 - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
    Python: 3.7.7 - /usr/local/opt/python/libexec/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0
    react-native: ^0.62.2 => 0.62.2
  npmGlobalPackages:
    *react-native*: Not Found

Description

When one uses the iOS 14 SDK to build the app for a simulator, e.g. yarn react-native run-ios, the build fails. As far as I can tell, the cli-platform-ios package fails to successfully capture the stdout from xcodebuild in this section: https://github.com/react-native-community/cli/blob/f76add94dcfb647dd55b59a5fad9a4d5363962fa/packages/platform-ios/src/commands/runIOS/index.ts#L312-L357. This causes getProductName https://github.com/react-native-community/cli/blob/f76add94dcfb647dd55b59a5fad9a4d5363962fa/packages/platform-ios/src/commands/runIOS/index.ts#L282-L287 to not get the correct app name, which causes the “wrong” .app to be installed, so the entire thing fails. I have the app name set to something other than the scheme name, so that’s why this is an issue. To be sure, I’ve checked that the app builds successfully when using the release SDK and toolchain, so I know that the iOS 14 SDK is the cause of this.

Reproducible Demo

Any project whose App Name (in Xcode) is different than the scheme name.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 21 (12 by maintainers)

Most upvoted comments

Please check how to update the @react-native-community/cli to the latest version 😃

For anyone else stumbling here in panic mode; I solved this by pinning the ios platform tool version based on the above mentioned PR (RN 0.62.2).

"resolutions": {
    "@react-native-community/cli-platform-ios": "4.13.0"
  },

Just be sure you clean all node modules, derived data, etc then rerun npm/yarn install.

@thymikee That only works if you are on RN v0.62. I’m on 0.61.5 and it only updates to the latest v3 version and I presume that it’s because on 0.61.5, react native it’s constrained to the v3 version of the CLI.

Are there other solutions for those who are on v0.61 or lower?

Yeah, it worked for me when I used your PR.

@oeduardoal

PRODUCT_BUNDLE_IDENTIFIER = com.rinse.Team-Rinse
PRODUCT_NAME = Team Rinse