Developers registered with the iOS Developer Program can install and test their apps on iPhones to ensure compatibility. Rather than install every test version of an app on your phone, however, you can also run your app in iOS Simulator on your Mac. This program lets you quickly try out changes to your program and doesn't require an actual iPhone. If you are just getting started with development, you can even use the simulator without a registered developer account.
In order to test iPhone apps, you need to install Xcode, the development program used to code and design iOS apps. Even if you only want to run existing app code rather than design your own app, you need Xcode to run the iOS Simulator. Search for "Xcode" in the Mac App Store and download it to begin. Xcode is a free download and does not require a developer account.
Launching iOS Simulator
To start a simulated iOS device, open the "Xcode" menu, and click "Open Developer Tool" and then "iOS Simulator." From the simulator home screen, you can run built-in apps and change settings as you would on a real iPhone. To launch your own app's code in the simulator, load it in Xcode, pick the type of device to simulate in the scheme pop-up menu and click "Run." Xcode will automatically build your project from the current code before launching your app in the simulator.
Working With Your App
To interact with the simulated iPhone, click or drag on the screen to simulate taps and swipes, respectively. Press the "Option" key to simulate multi-touch features. For example, to pinch the screen, place your cursor on the screen and hold down the "Option" key. Drag the circles that appear to the starting locations for the simulated fingers. Hold "Shift," move the circles to the desired center location of the pinch and release the key. Finally, hold the mouse button and move the circles to the end position, and then release the "Option" key. To simulate non-touch features, such as rotating the screen, open the "Hardware" menu and pick an option.
Simulator Advantages and Limitations
The iOS Simulator cannot replicate every iPhone feature. If your app uses iPhone hardware components, such as the accelerometer, gyroscope, camera or microphone, you will have to test your app on an actual iPhone. The simulator also does not give an accurate representation of your app's performance on the iPhone hardware itself, so you should test your app on a real device after making significant changes. Unlike a real phone, however, the simulator has debugging features for finding errors in your app, including slowing down animations and marking misaligned images. You can enable these features in the "Debug" menu.
- Kevork Djansezian/Getty Images News/Getty Images