如何在 build.json 中指定 Cordova 构建目标 [英] How to specify Cordova build target in build.json
问题描述
我在执行 cordova build
时遇到错误.
xcodebuild:错误:无法找到与提供的目标说明符匹配的目标:
{ platform:iOS Simulator, OS:latest, name:iPhone 11 Pro Max }
由于我的应用程序只在 iPad 上构建,我想我需要为 iPad 设置一个构建目标,但我不知道如何做到这一点.
版本
- XCode:版本 11.1 (11A1027)
- 科尔多瓦:cordova@9.0.0
- MacOS:10.15 Catalina
我的 config.xml 有这些标签来指定 iPad:
完整错误:
读取构建配置文件:没有找到适用于 " 的模拟器.回退到默认目标.为iPhone 11 Pro Max"构建模拟器(com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro-Max、iPhone-11-Pro-Max).构建项目:/Users/lucaban/.ghq/github.com/mesqueeb/sokketsu/src-cordova/platforms/ios/Sokketsu.xcworkspace配置:调试平台:模拟器目标:iPhone 11 Pro Max运行命令:xcodebuild -workspace Sokketsu.xcworkspace -scheme Sokketsu -configuration Debug -sdk iphonesimulator -destination platform=iOS Simulator,name=iPhone 11 Pro Max build CONFIGURATION_BUILD_DIR=/Users/lucaban/.ghq/github.com/mesqueeb/sokkatsu/src-cordova/platforms/ios/build/emulator SHARED_PRECOMPS_DIR=/Users/lucaban/.ghq/github.com/mesqueeb/sokketsu/src-cordova/platforms/ios/build/sharedpch从命令行构建设置:CONFIGURATION_BUILD_DIR =/Users/lucaban/.ghq/github.com/mesqueeb/sokketsu/src-cordova/platforms/ios/build/emulatorSDKROOT = iphonesimulator13.1SHARED_PRECOMPS_DIR =/Users/lucaban/.ghq/github.com/mesqueeb/sokketsu/src-cordova/platforms/ios/build/sharedpchxcodebuild:错误:无法找到与提供的目标说明符匹配的目标:{ 平台:iOS 模拟器,操作系统:最新,名称:iPhone 11 Pro Max }Sokkets"的可用目的地方案:{ 平台:iOS 模拟器,id:B90FC025-F8EB-40B3-90C5-E9094C0FFD17,操作系统:13.1,名称:iPad Air(第三代)}{ 平台:iOS 模拟器,id:3131A6AD-3C4E-4CEA-8889-9C7E22EAF816,操作系统:13.1,名称:iPad Pro(9.7 英寸)}{ 平台:iOS 模拟器,id:A8055BC4-F95C-43FA-8B28-7FACBD3D57B6,操作系统:13.1,名称:iPad Pro(11 英寸)}{ 平台:iOS 模拟器,id:7FAD7B1C-70DD-407A-AC99-3ACAD2670726,操作系统:13.1,名称:iPad Pro(12.9 英寸)(第 3 代)}Sokketsu"的不合格目的地方案:{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device }{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device }xcodebuild:命令失败,退出代码为 70
您需要在 Xcode 中将 target-device
设置为 universal
再改回平板电脑完成后.
配置文件
PS:这个问题可能是在运行cordova build ios命令时在cordova-ios 5.0.1版左右开始的.
I'm having an error when I execute cordova build
.
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ platform:iOS Simulator, OS:latest, name:iPhone 11 Pro Max }
Since my app only builds on iPad, I think I need to set a build target to an iPad, but I'm not sure how to do this.
Versions
- XCode: Version 11.1 (11A1027)
- Cordova: cordova@9.0.0
- MacOS: 10.15 Catalina
My config.xml has these tags to specify iPad only:
<preference name="target-device" value="tablet" />
<preference name="deployment-target" value="10.3" />
The full error:
Reading build config file:
No simulator found for ". Falling back to the default target.
Building for "iPhone 11 Pro Max" Simulator (com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro-Max, iPhone-11-Pro-Max).
Building project: /Users/lucaban/.ghq/github.com/mesqueeb/sokketsu/src-cordova/platforms/ios/Sokketsu.xcworkspace
Configuration: Debug
Platform: emulator
Target: iPhone 11 Pro Max
Running command: xcodebuild -workspace Sokketsu.xcworkspace -scheme Sokketsu -configuration Debug -sdk iphonesimulator -destination platform=iOS Simulator,name=iPhone 11 Pro Max build CONFIGURATION_BUILD_DIR=/Users/lucaban/.ghq/github.com/mesqueeb/sokketsu/src-cordova/platforms/ios/build/emulator SHARED_PRECOMPS_DIR=/Users/lucaban/.ghq/github.com/mesqueeb/sokketsu/src-cordova/platforms/ios/build/sharedpch
Build settings from command line:
CONFIGURATION_BUILD_DIR = /Users/lucaban/.ghq/github.com/mesqueeb/sokketsu/src-cordova/platforms/ios/build/emulator
SDKROOT = iphonesimulator13.1
SHARED_PRECOMPS_DIR = /Users/lucaban/.ghq/github.com/mesqueeb/sokketsu/src-cordova/platforms/ios/build/sharedpch
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ platform:iOS Simulator, OS:latest, name:iPhone 11 Pro Max }
Available destinations for the "Sokketsu" scheme:
{ platform:iOS Simulator, id:B90FC025-F8EB-40B3-90C5-E9094C0FFD17, OS:13.1, name:iPad Air (3rd generation) }
{ platform:iOS Simulator, id:3131A6AD-3C4E-4CEA-8889-9C7E22EAF816, OS:13.1, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:A8055BC4-F95C-43FA-8B28-7FACBD3D57B6, OS:13.1, name:iPad Pro (11-inch) }
{ platform:iOS Simulator, id:7FAD7B1C-70DD-407A-AC99-3ACAD2670726, OS:13.1, name:iPad Pro (12.9-inch) (3rd generation) }
Ineligible destinations for the "Sokketsu" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device }
xcodebuild: Command failed with exit code 70
You need to set the target-device
to universal
and then change it back to tablet in Xcode when finished.
config.xml
<preference name="target-device" value="universal" />
PS: This issue started probably around cordova-ios version 5.0.1 when running cordova build ios command.
这篇关于如何在 build.json 中指定 Cordova 构建目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!