iPhone device vs. iPhone simulator

后端 未结 25 2254
暖寄归人
暖寄归人 2020-11-28 07:51

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 simula

相关标签:
25条回答
  • 2020-11-28 08:14

    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.

    0 讨论(0)
  • 2020-11-28 08:14

    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.

    0 讨论(0)
  • 2020-11-28 08:14

    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!

    0 讨论(0)
  • 2020-11-28 08:15

    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.

    0 讨论(0)
  • 2020-11-28 08:16

    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!

    0 讨论(0)
  • 2020-11-28 08:17

    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.

    0 讨论(0)
提交回复
热议问题