问题
Pretty sure my tests were running fine before I updated from Xcode 10.3 to Xcode 11. Now when I try to run a test I get the following error.
The run destination iPhone 5s is not valid for tests you have chosen to perform. Please select a run destination which supports the tests that you wish to perform.
As an experiment, I tried creating a brand new test target and running the example tests that it gives you and the error is the same. I've also tried with different simulators.
回答1:
Check your Targets: (test Target) -> Build Settings -> Deployment -> iOS
Deployment Target: select a lower iOS version eg: iOS 10.0
This will be solving your problem.
回答2:
Try out different simulators,
for me it solved by switching to my connected Device, run the test, than switch back to simulator.
回答3:
For me, my Targeted Device Family in the Build Settings for my test target, was iPad-only, whereas the Targeted Device Family was Universal for the app target.
I had to change the Targeted Device Family to Universal for my test target to match the Targeted Device Family for the app.
It was:
I had to change to:
来源:https://stackoverflow.com/questions/58078991/unable-to-run-unit-tests-in-xcode-11-the-run-destination-is-not-valid-for-tes