如何更改 react-native xcodebuild 的目标 ID
How to change destination id for react-native xcodebuild
我是 mac 的新手,我正在尝试克隆我当前的 WIP React 本机项目(仅针对 iOS 构建)并在我的新 Mac mac嗨。但是我不断遇到以下错误,我在 Xcode xcworkspace 中到处搜索,尝试了很多设置更改(部署目标等)并且不知道如何更改目标 ID。请帮忙。谢谢
elliotkaliv@Elliots-Mac-mini projNameeeeeeee % yarn ios
yarn run v1.22.10
$ npx react-native run-ios --simulator='iPad Air'
warn Package filenamify has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/elliotkaliv/Documents/prjs/projNameeeeeeee/node_modules/filenamify/package.json
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-vector-icons (to unlink run: "react-native unlink react-native-vector-icons")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Found Xcode workspace "projNameeeeeeee.xcworkspace"
info Building (using "xcodebuild -workspace projNameeeeeeee.xcworkspace -configuration Debug -scheme projNameeeeeeee -destination id=DDAF30B3-2CC8-460E-B05A-0E672CE9C59C")
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 projNameeeeeeee.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace projNameeeeeeee.xcworkspace -configuration Debug -scheme projNameeeeeeee -destination id=DDAF30B3-2CC8-460E-B05A-0E672CE9C59C
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ id:DDAF30B3-2CC8-460E-B05A-0E672CE9C59C }
Available destinations for the "projNameeeeeeee" scheme:
{ platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:EFF665D5-5FBC-514A-BBD3-F593B237E458 }
{ platform:iOS Simulator, id:96C0A232-B926-4C02-9DF6-89066487EF8D, OS:14.4, name:iPad (8th generation) }
{ platform:iOS Simulator, id:1F102212-0663-4AC1-8AF3-A6A46059B35C, OS:14.5, name:iPad (8th generation) }
{ platform:iOS Simulator, id:A193D152-0330-4FE5-BF13-874BA3538AC2, OS:14.1, name:iPad Air (4th generation) }
{ platform:iOS Simulator, id:F67B9A1B-E43A-47D7-9996-303E37CE9E91, OS:14.5, name:iPad Air (4th generation) }
{ platform:iOS Simulator, id:2DDEB0DB-D658-4343-9BBC-A2AE9BDFCBF4, OS:14.1, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:FB9B5898-9892-420B-BB70-67E19CF1BEEE, OS:14.4, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:EB82A729-BD5E-4F70-9F00-AE590AF743D0, OS:14.5, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:C58EB805-AFD9-4FA1-8FA5-EAA4034AA915, OS:14.1, name:iPad Pro (11-inch) (2nd generation) }
{ platform:iOS Simulator, id:E3496671-D43A-4E1A-B33D-476F2022FFB4, OS:14.4, name:iPad Pro (11-inch) (2nd generation) }
{ platform:iOS Simulator, id:0965280C-C978-4721-B720-D51AF187CCA9, OS:14.5, name:iPad Pro (11-inch) (3rd generation) }
{ platform:iOS Simulator, id:29A34DD5-637E-41A8-9F11-B3EA9660083B, OS:14.1, name:iPad Pro (12.9-inch) (4th generation) }
{ platform:iOS Simulator, id:8D1E91AE-D046-43C6-8E56-DC16B01DDCC6, OS:14.4, name:iPad Pro (12.9-inch) (4th generation) }
{ platform:iOS Simulator, id:1C028811-E780-40D1-BDE0-73105A705367, OS:14.5, name:iPad Pro (12.9-inch) (5th generation) }
Ineligible destinations for the "projNameeeeeeee" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
回答我自己的问题,我不认为可以更改目标 ID,但可以更改模拟器名称。就我而言,我发现正确的命令是与我的模拟器名称完全匹配,即 example
npx react-native run-ios --simulator='iPad Air (4th generation)'
要重命名特定的模拟器名称,请转到 XCODE(给出的示例屏幕截图是 v13.0):
在工具栏上:Window
> Devices and Simulators
并将模拟器重命名为唯一名称
我是 mac 的新手,我正在尝试克隆我当前的 WIP React 本机项目(仅针对 iOS 构建)并在我的新 Mac mac嗨。但是我不断遇到以下错误,我在 Xcode xcworkspace 中到处搜索,尝试了很多设置更改(部署目标等)并且不知道如何更改目标 ID。请帮忙。谢谢
elliotkaliv@Elliots-Mac-mini projNameeeeeeee % yarn ios
yarn run v1.22.10
$ npx react-native run-ios --simulator='iPad Air'
warn Package filenamify has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/elliotkaliv/Documents/prjs/projNameeeeeeee/node_modules/filenamify/package.json
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
- react-native-vector-icons (to unlink run: "react-native unlink react-native-vector-icons")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info Found Xcode workspace "projNameeeeeeee.xcworkspace"
info Building (using "xcodebuild -workspace projNameeeeeeee.xcworkspace -configuration Debug -scheme projNameeeeeeee -destination id=DDAF30B3-2CC8-460E-B05A-0E672CE9C59C")
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 projNameeeeeeee.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace projNameeeeeeee.xcworkspace -configuration Debug -scheme projNameeeeeeee -destination id=DDAF30B3-2CC8-460E-B05A-0E672CE9C59C
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ id:DDAF30B3-2CC8-460E-B05A-0E672CE9C59C }
Available destinations for the "projNameeeeeeee" scheme:
{ platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:EFF665D5-5FBC-514A-BBD3-F593B237E458 }
{ platform:iOS Simulator, id:96C0A232-B926-4C02-9DF6-89066487EF8D, OS:14.4, name:iPad (8th generation) }
{ platform:iOS Simulator, id:1F102212-0663-4AC1-8AF3-A6A46059B35C, OS:14.5, name:iPad (8th generation) }
{ platform:iOS Simulator, id:A193D152-0330-4FE5-BF13-874BA3538AC2, OS:14.1, name:iPad Air (4th generation) }
{ platform:iOS Simulator, id:F67B9A1B-E43A-47D7-9996-303E37CE9E91, OS:14.5, name:iPad Air (4th generation) }
{ platform:iOS Simulator, id:2DDEB0DB-D658-4343-9BBC-A2AE9BDFCBF4, OS:14.1, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:FB9B5898-9892-420B-BB70-67E19CF1BEEE, OS:14.4, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:EB82A729-BD5E-4F70-9F00-AE590AF743D0, OS:14.5, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:C58EB805-AFD9-4FA1-8FA5-EAA4034AA915, OS:14.1, name:iPad Pro (11-inch) (2nd generation) }
{ platform:iOS Simulator, id:E3496671-D43A-4E1A-B33D-476F2022FFB4, OS:14.4, name:iPad Pro (11-inch) (2nd generation) }
{ platform:iOS Simulator, id:0965280C-C978-4721-B720-D51AF187CCA9, OS:14.5, name:iPad Pro (11-inch) (3rd generation) }
{ platform:iOS Simulator, id:29A34DD5-637E-41A8-9F11-B3EA9660083B, OS:14.1, name:iPad Pro (12.9-inch) (4th generation) }
{ platform:iOS Simulator, id:8D1E91AE-D046-43C6-8E56-DC16B01DDCC6, OS:14.4, name:iPad Pro (12.9-inch) (4th generation) }
{ platform:iOS Simulator, id:1C028811-E780-40D1-BDE0-73105A705367, OS:14.5, name:iPad Pro (12.9-inch) (5th generation) }
Ineligible destinations for the "projNameeeeeeee" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
回答我自己的问题,我不认为可以更改目标 ID,但可以更改模拟器名称。就我而言,我发现正确的命令是与我的模拟器名称完全匹配,即 example
npx react-native run-ios --simulator='iPad Air (4th generation)'
要重命名特定的模拟器名称,请转到 XCODE(给出的示例屏幕截图是 v13.0):
在工具栏上:Window
> Devices and Simulators
并将模拟器重命名为唯一名称