React Native CLI iOS构建失败,除非我手动指定UDID(错误代码70)



在使用react-native init生成的全新项目中,这按预期工作:

react-native run-ios --udid='4720C15A-8AED-45E5-B3CC-58461F5B4413'

但是没有UDID参数的react-native run-ios失败:

warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
info Found Xcode workspace "AwesomeProject.xcworkspace"
info Found [redacted]
info Building (using "xcodebuild -workspace AwesomeProject.xcworkspace -configuration Debug -scheme AwesomeProject -destination id=863BC019-F4A9-52FA-A489-94F23F2E4446")
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 70. To debug build logs further, consider building your app with Xcode.app, by opening AwesomeProject.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace AwesomeProject.xcworkspace -configuration Debug -scheme AwesomeProject -destination id=863BC019-F4A9-52FA-A489-94F23F2E4446
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES

2023-01-22 16:49:24.861 xcodebuild[29257:10638655] Writing error result bundle to /var/folders/hw/nxk409kd2r322j_4p504_fgr0000gn/T/ResultBundle_2023-22-01_16-49-0024.xcresult
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ id:863BC019-F4A9-52FA-A489-94F23F2E4446 }
The requested device could not be found because no available devices matched the request.
Available destinations for the "AwesomeProject" scheme:
{ platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:00006000-001A51E022E2801E }
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
{ platform:iOS Simulator, id:F4A58EA2-A0F8-4BD7-8FDB-57C8E7D0822C, OS:16.2, name:iPad (10th generation) }
{ platform:iOS Simulator, id:08E35727-BE07-48D1-A2DE-ED1A1E69CA28, OS:16.2, name:iPad Air (5th generation) }
{ platform:iOS Simulator, id:91D05BF6-12E3-4806-BA14-6DF72CB2C5BD, OS:16.2, name:iPad Pro (11-inch) (4th generation) }
{ platform:iOS Simulator, id:B1D01D46-AEF7-4DC2-B4FE-92A10E0FE6D2, OS:16.2, name:iPad Pro (12.9-inch) (6th generation) }
{ platform:iOS Simulator, id:28E59780-E621-4457-A218-504CF2DF9539, OS:16.2, name:iPad mini (6th generation) }
{ platform:iOS Simulator, id:19AB219B-78B1-404B-B9F3-FB954C0C93CA, OS:16.2, name:iPhone 14 }
{ platform:iOS Simulator, id:55A453E2-B60F-4AB4-859C-0A8BF8572AB8, OS:16.2, name:iPhone 14 Plus }
{ platform:iOS Simulator, id:1F841D64-D675-4D11-9592-FFF7F4AD066E, OS:16.2, name:iPhone 14 Pro }
{ platform:iOS Simulator, id:4720C15A-8AED-45E5-B3CC-58461F5B4413, OS:16.2, name:iPhone 14 Pro Max }
{ platform:iOS Simulator, id:781F0720-AA38-412D-B358-DA58E7E7A99C, OS:16.2, name:iPhone SE (3rd generation) }
info Run CLI with --verbose flag for more details.

建筑,通过Xcode UI运行也可以。

react-native start在独立终端运行

为什么react native默认使用不存在的目标ID,我如何修复它?

  • 反应18.2.0
  • react-native 0.71.1
  • react-native CLI 10.1.3
  • Xcode 14.2
  • macOS Ventura 13.1 on M1 Pro

我在0.71.2上遇到了这个问题。这似乎是自0.71.1以来一个开放的react原生错误。

链接到Github: https://github.com/facebook/react-native/issues/35917

相关内容

最新更新