iOS Simulator Tips

January 25, 2013

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:

Taking A Screenshot

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).

OS X Screenshot

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.

Screenshot Shortcut

Copying Text To The Pasteboard

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.

Copy & Paste

Measuring & Aligning

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.

Using A Retina Device In The Simulator

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.

Running Older iOS Versions

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.

Older iOS Versions

Now you can choose the target in Xcode, and also change the version in the simulator under Hardware->Version.

Syncing Photos

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:

No Photos

To get photos onto the simulator you can do one of the following:

  1. Drag and drop a photo onto the simulator, it will then open it in Safari.
  2. Open Safari and search for images. I often use Google Images to download a bunch to test with.

Once the image is displayed in Safari, tap and hold on it and then you can save it, it will then appear in Photos.

Save Photo

Simulate Memory Warnings

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.

Setting Your Location

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.

Custom Location

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.

Pinch To Zoom / Two Fingers

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.

Reset The Simulator

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.

Don't Trust The Simulator

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.

Tips From Others

Get Monthly Updates On Mobile Dev

Join over 2,000 other mobile devs.

No spam, promise!

Get Monthly Updates On Mobile Dev

Join over 2,000 other mobile devs.

No spam, promise!