I get this error when I trying to test an app.
A build only device cannot be used to run this target.
No supported iOS devices are available
xcodebuild things were not working in my case.
Here's what I've solved.
I've removed my apple account and re-set(login) on the xcode preference, and this was solved.
ps. on iphone 10.1, I needed to push Trust button on General > Device Management > account info > Trust App
You are building for Xcode's "Build Only Device", which is compiling the app. for the ARM processor (whereas compiling for the simulator targets the Intel CPU on your Mac.)
Plug in a device and select it from the active scheme popup, or, select one of the simulators and you should be good to go.
For xcode v11:
I ran into this issue when trying to create an Archive of my project. I was trying to click "Build" when the device was set to "Generic iOS Device", but the proper steps were:
I had an entirely different problem. For some reason my app "Devices" was set to Universal build as opposed to iPhone. When I switched it to iPhone everything worked. Didn't need any extra settings.
This worked for me.
You are trying to run on a device when you already built it for a different scheme. Go to
Product > Clean.
Then build with your device chosen from the active schemes.
You need to get a list of valid destinations. To do this, specify an erroneous key-value pair and xcodebuild will spit out the combinations that work:
List Destinations Command
xcodebuild test -destination 'platform=iOS Simulator' -workspace Register.xcworkspace -scheme ThatTestTarget
Output Example
Available destinations for the "ThatTestTarget" scheme:
{ platform:iOS Simulator, id:145A9B7E-B336-4819-8059-2FFEC408E05E, OS:11.1, name:iPad (5th generation) }
{ platform:iOS Simulator, id:69ABAF6F-ADA3-4E38-AC97-D71001447663, OS:9.3, name:iPad 2 }
{ platform:iOS Simulator, id:550E2F18-406D-4586-84BB-E48F1D704F27, OS:10.3.1, name:iPad Air }
{ platform:iOS Simulator, id:94734F1C-775F-40FA-9015-8196C08805EF, OS:11.1, name:iPad Air }
{ platform:iOS Simulator, id:1DB953DD-CD97-4EC7-8006-BCF01DF3E63F, OS:11.1, name:iPad Air 2 }
{ platform:iOS Simulator, id:DE3072DA-2E31-423D-9D77-220626F8B90A, OS:11.1, name:iPad Pro (9.7-inch) }
{ platform:iOS Simulator, id:3B5D18DB-13B5-4F28-B654-7D2ECDD1F6F0, OS:11.1, name:iPad Pro (10.5-inch) }
{ platform:iOS Simulator, id:A4225E3A-512C-4F42-ADD9-1E7E448C4D27, OS:11.1, name:iPad Pro (12.9-inch) }
{ platform:iOS Simulator, id:684FF1BA-8784-4B7C-B4E5-5231772F0FAC, OS:11.1, name:iPad Pro (12.9-inch) (2nd generation) }
Change Colons for Equals Signs, Remove Spaces, Ignore the ID
So if you want to use this destination:
platform:iOS Simulator, id:684FF1BA-8784-4B7C-B4E5-5231772F0FAC, OS:11.1, name:iPad Pro (12.9-inch) (2nd generation)
Change the colons for commas, remove the spaces, remove the ID, so you get this string:
platform=iOS Simulator,OS=11.1,name=iPad Pro (12.9-inch) (2nd generation)
Then the entire command would be:
xcodebuild test -destination 'platform=iOS Simulator,OS=11.1,name=iPad Pro (12.9-inch) (2nd generation)' -workspace Register.xcworkspace -scheme ThatTestTarget