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
I fixed this issue by going to the project settings, and under my 'Targets' section I had to set the Tests target to the correct team.
i meet a problem that only "Generic iOS Device" can be choosed. and when i run ,it says "A build only device cannot be used to run this target.No supported iOS devices are available. Connect a device to run your application or choose a simulated device as the destination "
and my solution for the problem is selecting Build Settings ---> Deployment ----->IOS Deployment Target---->choose a lower version like 8.0,
and i found the simulator come out and can be chosen.
If you are using cordova/Ionic Go to Products -> Destination-> Choose the target and re run
add -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.3'
to your xcodebuild
For what it's worth, if you get the error A build only device cannot be used to run this target
, and see in the Issue navigator this text:
ProjectName
Target Integrity:
iOS Deployment Target 'XX.X' is
newer than SDK 'iOS YY.Y' in
target ProjectName
then the issue is that the project requires an iOS SDK that is newer than what your version of Xcode has available. You'll find this issue in, say, projects taking advantage of new/beta iOS SDK functionalities such as ARKit.
The solution is to download the newest beta version of Xcode, which should have support for the non-public released iOS SDK that the application requires. If you have the latest Xcode, try finding the target iOS in Preferences -> Components -> Simulators
.
Modification to @Quver's answer. With latest Xcode version(8.3), the parameters to destination command should be given in double quotes. Single quotes didn't work for me
add -destination "platform=iOS Simulator,name=iPhone 7"
to your xcodebuild
I haven't mentioned OS version in above command because when a newer version of iOS is released, this command will through error telling that this device is not found. So it is better not to give OS version