Xcode 7: Xcode cannot run using the selected device

567 Views Asked by At

After upgrade to Xcode 7, Xcode cannot run tests on simulator.

$ xcodebuild test -sdk iphonesimulator -scheme MyProject
Build settings from command line:
    SDKROOT = iphonesimulator9.0

xcodebuild: error: Failed to build project MyProject with scheme MyProject.
    Reason: Xcode cannot run using the selected device.

The issue is reproduced on Travis CI and Jenkins. It's worked fine when I run xcodebuild test on a local machine.

1

There are 1 best solutions below

2
On

I've gotten past this error by adding a flag like -destination 'name=iPhone 6'. It seems like xcodebuild used to pick a default destination but isn't doing that anymore. =|

I'm going to see if there is anything I can set in the build scheme to avoid hard coding a device.