I’m running automated application unit tests under a C.I. environment for iPhone apps and everything works fine using a command line such as;
xcodebuild -scheme "Tests" -configuration Debug -sdk iphonesimulator5.0
That’s great, but I now want to force the iPhone simulator to launch in Retina mode, rather than the default standard mode.
I know I can toggle this with the hardware menu option, however I’m running this on a headless integration server so don’t have that option.
What I’d like to do is pass a switch somehow on the command line that tells the simulator to launch in Retina mode.
I optimistically tried appending SimulateDevice=”iPhone (Retina)” to the xcodebuild command, but that seems not to work.
Is this possible? I can’t seem to find a way at the moment.
If it’s not possible, is there an alternative approach I can take?
You should use AppleScript to change the value of
SimulateDeviceincom.apple.iphonesimulator.plist.Here is an example that does that after prompting the user to choose the desired device type. You can modify it to read the value from the command line or use
"iPhone (Retina)"as a default value.The following script changes the simulator device into a value from the command line:
And you can execute it from the terminal using the command
osascript:Or
Edit
You can modify that script to make it launch the Retina simulator by default:
Finally note that changes to
"SimulateDevice"take effect only when a new simulator is launched.