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
With XCode 8.3.2 I had this error message after I tried to run the app on a locked device. I unlocked and reattached as requested but the "A build only device cannot be used to run this target." message appeared.
I simply changed the target to a simulator and changed it back - it resolved my issue.
Maybe the Scheme has switched to a Generic device. Try to choose again the connected device from the Scheme menu:
I encountered the same error message. Here's what I have experienced and did so far;
Step 1: Check your target.
My current target is IOS 13.2. From here, you will not see what versions you currently have on your machine.
Step 2: Check available versions on your local
- Click the Generic IOS Device
- This will display a dropdown menu that contains a Download Simulators... selection
- In case the Download Simulators... selection is not visible, you need to lower down your target. In my case, from 13.2 I made it 13.0 (This depends on your current XCode) then repeat the Step 2 again
- From here, I can now see the Download Simulators... selection
- Select it
- You will now see what are the available versions you have
- From here, you may choose to download or just use the version you have (The one that is selected)
Step 3: Change your IOS target accordingly
- Now that you already know what are the available versions of the simulator you have locally, you can now change the IOS target.
- In my case I choose to use IOS 11 (Just for this sample)
- Then I change the target
- Again click the Generic IOS Device
- From here, you can now select any simulator under that IOS
I am not an expert, I just wanted to share my experience and I hope this can help someone.
In my case this happened, when I selected a Generic iOS device and tried to "build" in order to publish it to the AppStore.
But I should have selected Product -> Archive instead
Well if you want to get the list of available destinations then call xcodebuild and pass in the command line option -showdestinations
, and it will print valid options for you to pick from:
xcodebuild -showdestinations -workspace Register.xcworkspace -scheme ThatTestTarget