Easily fix "build only device cannot be used to run this target"

This page has moved to programmingwithswift.com

Featured image

This is an issue that I got recently. I have to be honest, I don’t often write unit tests which is something that I am starting to change, hence me getting stuck with this little issue.

Turns out I was missing something really obvious. I was using the “Generic iOS Device” from the simulator/device drop down list.

In order to fix this issue all one needs to do is to switch to a proper simulator or device and this error will go away.

If you want to see a video tutorial on this I have created one, you can watch it below:

Conclusion

I hope that this has helped you get over this issue. I was struggling a bit as I didn’t even think of the simulators.