The iOS Simulator and I have a love / hate relationship. It's super handy to quickly run your app on a variety of devices and iOS versions, but it can have you chasing bugs that just don't exist on the device.
Here are some tips that I use to get the most out of the simulator:
Of course there is the built in OS X tools to grab the simulator with the entire device frame by using command-shift-4 and then highlight the window (or pick the area).
But sometimes you just want to grab the actual content. If you press command-ctrl-c it will copy the screen to the clipboard, then you can easily paste it into a graphics app, or just use Preview and File->New From Clipboard.
Often I'll want to be able to paste text from OS X into the simulator, unfortunately just copying won't work. However, if you select the simulator and press command-v then it will become the current pasteboard text.
When working to designs you need to make sure things are aligned and the correct size (or you are going to have a grumpy designer). I'm a late convert, but I love xScope app for this. It's not cheap (but there is a demo on their site so you can try it out) but it is extremely powerful.
Here is an example of the measurement tool (on a retina MBP, hence the double size):
The guides are also useful when working with fixed gutters and/or grids.
Retina iPhones and iPads are really high res, you find that out pretty quickly when you try and run them on a lower res screen such as a Macbook Air. I'm lucky enough to have a retina MBP now, before I used a combination of a Thunderbolt external display and the Window->Scale options in the simulator to make it usable.
By default you just get the current iOS version simulator. Luckily you can install older versions by going to Xcode and selecting Xcode->Preferences->Downloads.
Now you can choose the target in Xcode, and also change the version in the simulator under Hardware->Version.
Unfortunately there is no way to test the camera via the simulator, but it is a good way to test you can handle devices without a camera (i.e. older iPod Touches).
By default the simulator has no photos and you get a really unhelpful message to sync them via iTunes:
To get photos onto the simulator you can do one of the following:
Once the image is displayed in Safari, tap and hold on it and then you can save it, it will then appear in Photos.
This is one of the more useful features of the simulator (Hardware->Simulate Memory Warning), being able to simulate memory warnings in all situations is really useful in tracking down bugs. These bugs often don't show up on your brand new iPhone 5, but will for those user with an iPhone 3G with less RAM.
Testing and debugging GPS features on the simulator isn't very useful, but you can at least set your location now. Debug->Location->Custom Location allows you to set your GPS co-ordinates. This is especially useful when creating demos / walkthroughs.
The simulator is useful for creating demo videos. My favourite tool for recording and editing the video is Screenflow. Like xScope it's not cheap, but it does have a demo.
With Screenflow you can choose to hide the cursor, I like to replace it with Simfinger.
If you need to test something like pinch to zoom on maps, you can just hold down the option key and drag the mouse / trackpad.
Resetting the simulator (iOS Simulator -> Reset Content & Settings) is useful for checking your app as if it had never been run on the device. Things such as permissions (location, Twitter, Facebook, Photos etc) persist, so resetting the simulator is often your best option.
The simulator isn't perfect so you still need to test thoroughly on real devices. Don't try and hunt for bugs for too long before confirming they actually are reproducible on a device.
What have I missed? Tweet me your tips below.
@stuartkhall tip for young players. File names in the sim are not case sensitive unlike the device.— Ben Trengrove (@bentrengrove) January 25, 2013
@stuartkhall new tip: you can simulate 2-finger panning (not zooming) with opt-shift click-and-drag— Nick Takayama (@ntakayama) January 25, 2013
@stuartkhall more precisely, hold opt first and you see two dots. move mouse to set initial positions. hold shift to lock relative positions— Nick Takayama (@ntakayama) January 25, 2013
@stuartkhall cmd+s -> instantly save screenshot to desktop. Also checkout DCIntrospect, really helpful!— Andreas v.d. Griendt (@avdgriendt) January 26, 2013
Join over 2,000 other mobile devs.
No spam, promise!