I frequently hear variations of the question: “Will an iOS app run on a device the same way it does in the simulator?” And usually when I dig in more, I find that the question behind the question – the real reason people are asking – is this: “Do I need to test my app on a device before submitting it to Apple?”
So should you test your app on a device before releasing it on the App Store? To answer this, let’s look at the differences between a real device and the iOS simulator.
1. Your code is compiled differently for the simulator than it is for a device.
When you run an app in the simulator, it’s compiled for an x86 architechture. When you run on device, it’s compiled for an ARM architecture. So when you test on the simulator, you’re not even testing the same compiled code that will run on a device.
2. Some APIs aren’t available in the simulator.
The APIs for push notifications, the camera, and the microphone aren’t available in the simulator, so you can’t test those things in the simulator. If your app uses any of those things, the only way you can test them is on device.
3. Real devices have less memory, storage, and processing power than the simulator.
Running on a device puts you under much tighter constraints: less memory, less storage, and a slower processor than the simulator. If you’re working with table views with lots of data, parsing big chunks of JSON, or using Core Data heavily, the performance difference between simulator and device is quite noticeable. In some cases, an app will run on the simulator just fine – and be totally unusable on device.
4. In the simulator, you click. On device, you tap.
This may sound like a minor difference, but I can tell you from experience that clicking on buttons in the simulator is much different from tapping them on a real device. While clicking buttons of almost any size is easy in the simulator, it’s often not so easy to tap them on device. Running on a real device can help you to see whether your buttons are large enough to tap easily.
5. Testing gestures in the simulator is hard.
While the simulator has some support for gestures like the pinch one, it’s hard to get it right. Testing the pinch gesture – and some of the swipe gestures – is much easier with fingers on a real device than it is with a mouse pointer in the simulator.
So for all those reasons and more, I always test my apps on device before submitting them to Apple for review – and so should you. Apps run differently in the simulator than they do on device – due to device constraint, different compiled code, and missing APIs – and sometimes bugs show up on device but not in the simulator. Your app will run differently on device than it does in the simulator, so for your users’ sake, test your apps on a real iOS device before you ship them.