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.
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.
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
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.
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.
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.
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:
I tried almost anything above, including restarting XCode, none of them worked for me. I solved this problem by simply restarting my Mac. Yes, the classic solution.
A side note: This problem occurred to my XCode after it requested my Mac password from me, probably after an automatic upgrade.
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:
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
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.