I have heard of apps not working properly on the simulator but working properly on the actual iPhone device. Has anyone experienced an app that runs perfectly in the simulator but not on the actual iPhone device?
-
I hope this URL will be helpful to you: *Differentiate between iPhone, iPad and simulator* #if TARGET_IPHONE_SIMULATOR // simulator specific code #elif TARGET_OS_IPHONE // iPhone specific code #elif TARGET_OS_IPAD // iPad specific code #else // Unknown target #endif http://cduu.wordpress.com/2010/10/20/differentiate-between-iphone-and-simulator/ – user1564754 Aug 31 '12 at 11:31
25 Answers
Filenames are case-sensitive on the iPhone, but not in the simulator.
So, for example, if you try to load an image with UIImage *iconImage = [UIImage imageNamed:"MyIcon.png"]
, but your resource is actually named "myicon.png", then it will work on the simulator, but not on the device.

- 81,409
- 55
- 245
- 302
-
-
5I don't think they would consider it to be a bug. The iPhone's filesystem isn't intended to be the same as a Mac's, and the Mac's filesystem is case-insensitive for historical reasons. – Kristopher Johnson Apr 09 '10 at 20:45
-
So we would want (and need) 10 filenames on the iPhone... all called the same... except for case? What would be the purpose? Just to *DELIBERATELY* not match millions of mac filesystems? What would be the big benefit? – Susanna Jun 15 '10 at 16:57
-
4Most UNIX-based systems have case-sensitive filesystems. Mac OS X is "weird" in this regard, and it was done this way to maintain compatibility with pre-OSX Mac systems. There is really no reason for iOS to match it. – Kristopher Johnson Jun 16 '10 at 12:14
-
1You can actually specify the case sensitivity of your new Mac filesystem in the Disk Utility... Before formatting, that is. – Gyuri Nov 09 '10 at 06:35
-
13It is unquestionably a bug in the simulator. The simulator is supposed to simulate what will happen on the device. The excuse of "oh, the Mac filesystem is case-insensitve" is just that: an excuse. Apple could easily fix this. – Todd Lehman Jun 27 '12 at 17:22
If your app is graphics intensive, like say a game, the performance of the simulator DOES NOT resemble at all that of the hardware. Your application will probably be smooth and work great on the simulator, but on hardware it'll likely render at a crawl unless you know what your doing. You can easily go from 60fps to 3fps between Simulator and hardware.

- 68,773
- 61
- 187
- 272
-
3I saw the opposite: my app would crawl on the Simulator, but be fine on the device. I think it is due to poor graphic capabilities of the MacBook; it may have been better with a better Mac. – Kristopher Johnson Dec 19 '08 at 13:27
-
2Kristopher, that doesn't sound right. According to my benchmarks, my first-generation (white) Core 2 Duo MacBook can push 9X the triangles per second in OpenGL that the iPhone can. Perhaps you have a thread-locking issue that's jamming up your rendering. – Brad Larson Dec 19 '08 at 14:01
-
1No threads, and not using OpenGL. But the point is that performance can be radically different between the two platforms. – Kristopher Johnson Nov 11 '09 at 15:12
-
6I have seen a number of situations where animations wouldn't be 100% smooth in the iPad simulator, but were absolutely fine on the device. Core Animation performance is _not_ always better in the Simulator, and you should always test on an actual device. – Nick Forge Apr 22 '10 at 09:06
-
2Using Cocos2d I average 30 fps on the simulator. When I run the same app on an real iPad, I average 60 fps. – Jay Haase Nov 21 '10 at 07:51
-
When running the simulator as e.g. an iPad I would guess it has to deduct 1Ghz from the computer to create a reasonably similar experience. That is some hit for 2GHz machine! My experience is also that I often get a speed boost when going from simulator to device. – RickiG May 15 '11 at 17:13
The order in which function/constructor parameters are evaluated is different:
int i = 0;
int f() { return ++i; }
int a, b;
int test(int p1, int p2) {
a = p1;
b = p2;
}
test( f(), f() );
//simulator: a = 2, b = 1
//device: a = 1, b = 2
-
7The order is really undefined/implementation-dependent. So you could see different behavior on the same platform if you used two different versions of the compiler. – Kristopher Johnson Jun 27 '12 at 18:42
Trigonometry functions may return different results:
float a = cosf( 0.108271248639 );
printf("%.12f", a);
//simulator: 0.994144439697
//device: 0.994144380093

- 8,194
- 3
- 29
- 40
There are certain bits of code that won't work on the simulator (using the iPhone Keychain, for example), but for almost all applications, the simulator will work exactly like the iPhone.
That said, there's absolutely no replacement for testing on a real device.

- 12,139
- 3
- 29
- 30
-
2I think memory management is a big exception to that. The rule of thumb that you always test on hardware is spot on though. – Rog Mar 27 '09 at 23:01
I know there are some differences in the OpenGL ES implementation between the device and the simulator. From what I understand this is mainly because of the graphics chip on the iPhone (PowerVR MBX) having vastly different capabilities than other mac machines. Many of the hardware limits are not enforced in the simulator, so it is entirely possible to get something running in the simulator that will totally crash on the device.
There are also some OpenGL ES extensions that are supported by the iPhone hardware that are not supported in the simulator. I believe the major one is PowerVR texture compression (PVRTC).
Another problem area can be memory footprint. Anecdotally, I have not seen the simulator automatically enforce the memory limitations of the device. Therefore, it is possible to have something that runs in the simulator fine, happily consuming copious amounts of RAM and never bothering to free any of it only to be swiftly terminated after a short continuance of such behaviour when running on a device.
-
1Another difference to watch out for in the graphics chip is that the iPhone only supports unsigned shorts as data types for indices, which means that you can only address 65,536 vertices in one vertex array. The Mac supports much larger data types. This caused me problems. – Brad Larson Dec 19 '08 at 14:09
Fingertips are larger than the 1 pixel endpoint of a mouse cursor. To do proper, even minimal, usability testing you should deploy your App to a device.

- 2,185
- 1
- 21
- 32
I had a problem running a relatively simple 1/30 sec timer to do updates for a game. It runs fine in the simulator, and freezes out input on the device.

- 67
- 2
-
-
2use CADisplayLink instead of NSTimer. If you're using NSTimer for constant updates faster than 1 or 2 seconds, you should probably be using CADisplayLink instead (added iOS 3.1) – John Haney Feb 24 '11 at 19:08
Also note that you will be compiling against the OS X frameworks (where applicable) when building for the simulator so you could be using methods and classes that aren't available on the iPhone versions of the frameworks.
One example I can think of off the top of my head is NSPredicate. I was able to compile and run an app using NSPredicate in the simulator, but it wouldn't compile for the device since that class isn't available.

- 36,329
- 7
- 58
- 54
If you enable GCC_ENABLE_FLOATING_POINT_LIBRARY_CALLS, your app will crash all over the place in the simulator but work on the iPhone.
Quartz graphics calls in the iPhone simulator are faster than Java2D calls on the same computer--wicked fast.
I've had issues in memory-hungry applications where the Simulator would work just fine (because it would assume the iPhone/iPod Touch's memory was all yours to play with), while the device would crash (because other apps had leaked and Apple background services had eaten up some memory) and I hadn't implemented proper memory management or a response to the didReceiveMemoryWarning
selector.

- 59,527
- 19
- 156
- 165
One big thing that took me a while to spot was that the simulator does not support device tokens, so any code that involves those will not run on the simulator.
I had a bug where the app would work fine on the simulator, but would crash when I ran it on a device because there was a bug in the device token code. I couldn't figure it out for the longest time!

- 86
- 6
There are many trivial examples. For example you can allocate far more memory on the simulator than on a real phone. You cannot receive push notification on the simulator if you don't have a retina Mac, the display dot pitch is different.
At a more fundamental level, the simulator is just that, it simulates the iPhone OS X using Mac OS X. This is evidenced by the fact that the filesystem on the simulator may not be case sensitive but on the phone it will be. More subtly, it does not emulate hardware so things like location will not work the same and 3D is going to be very different - especially if you are using Metal.
You should always test on real hardware.

- 17,070
- 9
- 50
- 73
-
The question asks for instances where there are differences. Instead of just saying "there are many" and then giving only one example, it'd be great if you actually listed a few more examples. – fatuhoku Aug 22 '14 at 12:14
-
Yes sir! Maybe you could have added them in a comment or edited the answer yourself. – Rog Aug 26 '14 at 10:22
movie file (m4v type) as my exprience is first time playing properly
but at second time it flickers screen of simulator...
whereas in iPhone device it works fime...

- 2,893
- 5
- 31
- 42
If status bar of application is hidden,In case of simulator it still consumes touch event. But in the device it behaves perfectly.

- 1,597
- 2
- 17
- 29
When trying to access the UIDevice.currentDevice(), it returns iOS Simulator instead of the actual device you're testing. This sucks, since you can't do certain things on the simulator.

- 3,370
- 3
- 28
- 49
Without considering the performance differences between the two, there used to be some things that the simulator didn't do correctly - i.e. it would mess up audio in some cases (see this question). However since the 2.2 SDK this issue has been resolved and the sound seems to be fine in the simulator. That's not to say that there is some other incompatibilities lurking down there! (Just none I've run into)

- 1
- 1

- 44,628
- 11
- 58
- 63
I had some sound effects that played fine in the simulator, but not on the device. I had to change the format to something that the device would handle.

- 81,409
- 55
- 245
- 302
Yes - it happened to me the other day. I'm new to the iphone, and so had deleted MainWindow.xib thinking it was unused. The app worked perfectly on the simulator - but crashed when installing on the phone.
Another issue we ran into was our three20 dependencies, which were set to ios 3.2 instead of 4.1. Worked perfectly in the simulator, but bombed on the device (since the files were compiled for the wrong arch).

- 6,530
- 8
- 55
- 60

- 437
- 2
- 7
- 18
iphone video library is not accessible in simulator but code work fine on actual device

- 9,660
- 22
- 90
- 120
Regarding sounds, I was having the same problem. The issue was that the sound encodings that the Simulator supports is a different set of sounds than the device. I hope that helps.
I had many problems with libraries and frameworks when moving from the simulator to the device. Not least that they seem to have different architectures!

- 31
- 1
- 4
I have seen the positioning of objects, like toolbars be different on simulator than on the phone. Very annoying.

- 23,422
- 22
- 79
- 93
Yeah....
Apps compiled for 2.x will work fine on 3.0 device, but it will crash on 3.0Simulator
Note: 1. If you compile for 3.0, app will work fine on 3.0 simulator also... 2. a)Compile for 2.x and launch the app in simulator. b)Now change the iPhone Simulator Hardware to "3.0". c)Then launch the app we installed earlier in step a). CRASH !!!!!!!!
Resource loading in the simulator is MUCH faster than in the device. For example, loading and displaying a sequence of full-screen UIImages
(like a rudimentary video) can look very smooth in the simulator, and choppy on a device.
In fact, remember that there is a huge speed difference between different devices. The original iPhone and the iPhone 3G are slower than the iPod touch 2nd Gen, which is also much slower than the iPhone 3GS, and so on.

- 3,879
- 1
- 21
- 20