Testing and Debugging in iOS Simulator

iOS Simulator is a great tool for rapid prototyping and development before testing your app on a device. iOS Simulator also has features that can assist you in testing and debugging both iOS apps and web apps. By understanding the tools that iOS Simulator offers, you can more efficiently develop your app.

Limitations of Testing in iOS Simulator

Even though iOS Simulator is a useful tool, never make it the only way you test an app. Because iOS Simulator is an app running on a Mac, it has access to the computer’s memory, which is much greater than the memory found on a device. As a result of the increased memory, iOS Simulator is not an accurate test of an app’s memory usage. For this same reason, always test the performance of your app’s user interface on a device. In iOS Simulator, your app’s user interface may appear to run both faster and smoother than on a device.

Also keep in mind that some user interface elements can be easier to interact with in iOS Simulator using a mouse than when trying to interact with the app via touch on a device.

Finally, there are some hardware and API limitations of iOS Simulator. These limitations may affect your app when testing in iOS Simulator.

Hardware Limitations

Though most of the functionality of iOS devices can be simulated in iOS Simulator, some hardware features must be tested directly on a device. The hardware features that cannot be simulated are:

  • Motion Support

    • Accelerometer

    • Gyroscope

  • Audio and Video Input

    • Camera

    • Microphone

  • Proximity Sensor

To test your app on a device, you must be a member of the iOS Developer Program. To learn more about enrolling in the iOS Developer Program, see Managing Accounts in App Distribution Guide.

OpenGL ES Limitations

iOS Simulator includes complete implementations of OpenGL ES 1.1, 2.0, and 3.0 that you can use to start developing your app. The capabilities of iOS Simulator are similar to those of the A7 GPU; for more information on the iOS hardware, see iOS Device Compatibility Reference. iOS Simulator differs from the hardware processor in a few ways:

  • iOS Simulator does not use a tile-based deferred renderer.

  • iOS Simulator does not provide a pixel-accurate match to the graphics hardware.

  • Rendering performance of OpenGL ES in iOS Simulator has no relation to the performance of OpenGL ES on an actual device.

API Limitations

Within iOS Simulator, there are some limitations to the APIs and features, including:

  • Apple Push Services

  • Privacy alerts for access to Photos, Contacts, Calendar, and Reminders

  • The UIBackgroundModes key

  • iCloud document syncing and key-value storage support

Unsupported frameworks include:

  • External Accessory

  • Media Player

  • Message UI

  • Event Kit

  • In UIKit, the UIVideoEditorController class

iOS Version Limitations

iOS Simulator does not have complete backward compatibility. In addition to supporting iOS 7.1, iOS Simulator supports iOS versions 7.0 and 6.1.

To use iOS Simulator for iOS 7.0 and later, you must be running Xcode 5.

Testing for the iPad mini

Although an iPad mini isn’t an option for a simulated device in iOS Simulator, you can still test apps for the iPad mini in the simulator. To do this, run your app on the simulated iPad without Retina display.

Testing for 64-bit Compatibility

iOS Simulator includes the ability to simulate 64-bit hardware. Choose one of the simulator targets that includes 64-bit in the name; your app is automatically compiled using the 64-bit data types described in 64-Bit Transition Guide for Cocoa Touch. Use Simulator to test any changes in your code that were necessary to support the new data sizes and alignments.

Some changes in the 64-bit ABI are not testable in Simulator. For example, any changes related to function or method calls can only be discovered when running on actual iOS hardware. So, as with developing any other iOS app, Simulator is best used only for the initial work to develop and test your app.

Testing App Accessibility

Use the Accessibility Inspector to test the accessibility of your app. The Accessibility Inspector displays accessibility information about each accessible element in an app. Figure 3-1 shows what the Accessibility Inspector looks like as it runs in iOS Simulator.

Figure 3-1  The Accessibility Inspector running on a simulated iPhone

To start the Accessibility Inspector

  1. When iOS Simulator is running, choose Hardware > Home to reveal the Home screen.

  2. Click Settings.

  3. Go to General > Accessibility.

  4. Slide the Accessibility Inspector switch to On


Turning on the Accessibility Inspector in iOS Simulator alters the behavior of the simulator. After the Accessibility Inspector is on, clicking an element moves the focus of the inspector to that element instead of activating it. To activate an element, you must double-click it. Additionally, swiping and dragging gestures are unsupported while the Accessibility Inspector is running. To perform these gestures, you must first disable the Accessibility Inspector. To disable and reenable the Accessibility Inspector, click the close control in the upper-left corner of the inspector panel (the close control looks like a circle with an “X” in it).


For more information on using the Accessibility Inspector and testing the accessibility of your app, see Verifying App Accessibility on iOS.

Testing App Localization

If you have created an app with multiple localizations, you can test them in iOS Simulator by changing the Internationalization settings. For how to set the language and region on iOS, read Reviewing Language and Region Settings on iOS Devices in Internationalization and Localization Guide. For more information on localizing your app, read Internationalization and Localization Guide.

Testing Web Apps

If you are building a web app and want to test its usability on an iOS device, iOS Simulator can assist you.

To test a web app in iOS Simulator

  1. Select the simulator environment you would like to test in by choosing a device from the Hardware > Devices menu.

  2. Open Safari from the Home screen of iOS Simulator.

  3. Navigate to the location of your web app in the browser.

For more information on creating web apps for iOS, see Getting Started with iOS Web Apps.

Testing iCloud

If you are building an app that uses iCloud, you can test iCloud syncing from within iOS Simulator before testing on physical devices. This can also assist you in testing iCloud syncing across many devices if you have a limited number of devices to test on.

To simulate iCloud syncing, you must first sign in to iOS Simulator using an Apple ID. It is strongly encouraged that you create and use a separate Apple ID specifically for testing iCloud in iOS Simulator.

To sign in to iOS Simulator with your Apple ID

  1. Launch iOS Simulator with a simulated device running iOS 7.1 or later.

  2. From the Home screen, open Settings and select iCloud.

  3. Enter your Apple ID and Password, and click Sign In.

After signing in with your Apple ID, you can then test your iCloud syncing. To test to see whether your app is syncing properly with iCloud, choose Debug > Trigger iCloud sync.

Testing Background Fetching

If you are building an app that receives frequent content updates and you have enabled background fetching, you can test the background-fetch capability using Xcode and iOS Simulator. To simulate a background fetch, launch your app in iOS Simulator and then go to Xcode and choose Debug > Simulate Background Fetch.

You can also configure a scheme to control how Xcode launches your app. To enable your app to be launched directly into a suspended state, choose Product > Scheme > Edit Scheme, and select the Background Fetch checkbox.

Using the Debugging Tools in iOS Simulator

Access the debugging tools in iOS Simulator through the Debug menu, as shown in Table 3-1.

Table 3-1  Performing debugging through the iOS Simulator Debug menu

Menu item

Debug result

Toggle Slow Animations in Frontmost App

Slows down the animation taking place within the app. Use to identify any problems in the animation. Toggle Slow Animations can also be activated by pressing the Shift key three times.

Color Blended Layers

Shows blended view layers. Multiple view layers that are drawn on top of each other with blending enabled are highlighted in red, while multiple view layers that are drawn without blending are highlighted in green. Reduce the amount of red in your app when this option is selected to dramatically improve your app’s performance. Blended view layers are often the cause of slow table scrolling.

Color Copied Images

Places a blue overlay over images that are copied by Core Animation in blue.

Color Misaligned Images

Places a magenta overlay over images whose bounds are not aligned to the destination pixels. If there is not a magenta overlay, places yellow overlay over images drawn with a scale factor.

Color Off Screen Rendered

Places a yellow overlay on content that is rendered offscreen.


Allows you to set the Core Location to be used by your app. Choose from the different location settings:

  • None. Does not return a location. Use for testing how an app responds when no location data is available.

  • Custom Location. Allows use of a custom latitude and longitude.

  • Apple Stores. Uses the coordinates for an Apple Retail Store.

  • Apple. Uses the coordinates of the Apple Headquarters.

  • City Bicycle Ride. Simulates a bike ride in Cupertino, CA. This option simulates the device moving on a predefined route.

  • City Run. Simulates a run in Cupertino, CA. This option simulates the device moving on a predefined route.

  • Freeway Drive. Simulates a drive through Cupertino, CA. This option simulates the device moving on a predefined route.

Viewing Crash Logs

If your app experiences a problem that causes it to crash, a crash log can help you determine what problem occurred. You open the crash log using Console.

To view a crash log

  1. Open Console by going to Applications/Utilities/Console in the Finder.

  2. Look for the line in Console that reads “Saved Crash Report for.”

  3. Expand this item using the arrow at the left.

  4. Click Open Report.