9

I just downloaded and installed Xcode 5 GM seed. I removed the previous Xcode (DP5). When I open my project, select "iPhone Retina (4-inch 64 bit)" and type Command-U to run my SenTeskingKit unit tests, Xcode invariably complains:

"Simulator in Use - The Simulator can't be launched because it is already in use."

I have run xcode-select to point to the new Xcode, restarted my MacBookPro, and made sure there are no other iPhone sim processes running under the Activity Monitor.

pkamb
  • 33,281
  • 23
  • 160
  • 191
Rayfleck
  • 12,116
  • 8
  • 48
  • 74

4 Answers4

3

With Xcode 5 Version 5.0 (5A1413), I cannot run 64-bit unit tests at all. Always gives a "Simulator in use" error alert.

Quitting Xcode or the Simulator does not help.

My "solution", thanks to this question, is to run the tests against the 32-bit simulator.

pkamb
  • 33,281
  • 23
  • 160
  • 191
  • Seems to be an Xcode bug still in 5.0.2 :(. Can only run 32-bit unit tests. – Adam Feb 10 '14 at 22:05
  • @Adam I have been able to run 64-bit tests on Xcode 5.0.2 (5A3005). See my answer [below](http://stackoverflow.com/a/21781010/441735). – Yan Feb 14 '14 at 14:02
3

I had the same problem and found the reason.

Testing on the 64-bit Simulator needs Build Active Architecture Only to be YES.

By default this setting is YES for Debug and NO for Release:

Build Active Architecture settings

So check the Scheme settings and set Debug configuration for Test action:

enter image description here

Alternatively you can test from command line:

xcodebuild  -project {project}.xcodeproj -scheme {scheme} -sdk iphonesimulator -destination platform="iOS Simulator",OS=7.0,name="iPhone Retina (4-inch 64-bit)" -configuration Release ONLY_ACTIVE_ARCH=YES test
Yan
  • 886
  • 7
  • 13
  • 1
    For whatever reason, this is not broken anymore (I'm running xcode 5.0 - 5A1412) - it works with, or without, setting BAA to YES. – Rayfleck Feb 14 '14 at 20:50
  • Nice workaround. 90% of my unit-testing is for libraries - and it's very dangerous to have "build for active architecture only" set to an incorrect value (YES) - too easy to forget before committing! Hopefully Apple will fix the bug instead :). @Rayfleck 5.0 has many bugs, we had to switch to 5.0.2-preview to workaround some - but 5.0.2 has new bugs :(. Eagerly awaiting the next release. – Adam Feb 18 '14 at 12:36
0

I get this all the time and the only thing that seems to guarantee to fix it is restarting both Xcode and the Simulator. Sorry I don't have a better answer.

EDIT: Sometimes just changing device (e.g. from iPhone to iPad or from retina to non-retina) is sufficient.

Oliver Pearmain
  • 19,885
  • 13
  • 86
  • 90
0

Simply click on Quit Xcode from the editor menu of Xcode and open Xcode again. You will get the simulator.

Wayne Conrad
  • 103,207
  • 26
  • 155
  • 191
pulak
  • 11