mesqueeb
mesqueeb

Reputation: 6344

How to specify Cordova build target in build.json

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

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

Upvotes: 5

Views: 6907

Answers (3)

mobigaurav
mobigaurav

Reputation: 194

As you can see in terminal it says: xcodebuild: error: Unable to find a destination matching the provided destination specifier:

{ platform:iOS Simulator, OS:latest, name:iPhone 11 Pro Max }

You can follow below steps:

  1. Go to Xcode

  2. Under simulator target click 'Add Additional Simulators'

    enter image description here

  3. Once this screen pops up, click on + icon on bottom left corner enter image description here

  4. It will display a screen to add new simulator: Add the one for which your build is failing , in this case:iPhone 11 Pro Max, Select Device type as(iPhone 11 Pro Max) and latest OS version. enter image description here

  5. Go to terminal and try build command again.

Upvotes: 1

Amith Mihiranga
Amith Mihiranga

Reputation: 311

You can solve this issue by sending the device name as a buildFlag

If you are using cordova use below command

cordova build ios --buildFlag="-destination platform=iOS Simulator,name=iPad Pro (11-inch)"

For me, I was using this in an Ionic project.

ionic cordova build ios -- --buildFlag="-destination platform=iOS Simulator,name=iPad Pro (11-inch)"

You can choose any device name you want from the list Available destinations listed in your error

Upvotes: 4

mesqueeb
mesqueeb

Reputation: 6344

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.

Upvotes: 6

Related Questions