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
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