如何在 build.json 中指定 Cordova 构建目标

mes*_*eeb 5 xcode ios cordova

我执行时出错cordova build

xcodebuild:错误:无法找到与提供的目标说明符匹配的目标:

  { platform:iOS Simulator, OS:latest, name:iPhone 11 Pro Max }
Run Code Online (Sandbox Code Playgroud)

由于我的应用程序仅在 iPad 上构建,因此我认为我需要将构建目标设置为 iPad,但我不确定如何执行此操作。

版本

  • XCode:版本 11.1 (11A1027)
  • 科尔多瓦:cordova@9.0.0
  • MacOS:10.15 卡塔琳娜

我的 config.xml 有这些标签仅指定 iPad:

    <preference name="target-device" value="tablet" />
    <preference name="deployment-target" value="10.3" />
Run Code Online (Sandbox Code Playgroud)

完整错误:

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
Run Code Online (Sandbox Code Playgroud)

mes*_*eeb 6

您需要将其设置target-deviceuniversal,然后完成后在 Xcode 中将其更改回平板电脑。

配置文件

<preference name="target-device" value="universal" />
Run Code Online (Sandbox Code Playgroud)

PS:这个问题可能是在 cordova-ios 版本 5.0.1 运行 cordova build ios 命令时开始的。