My iPhone app works on the device, but not the simulator
My app works okay on the device, but not the simulator. When I run it on the开发者_开发问答 simulator I get no errors or anything. The app just dies a second after being launched. Does this really matter? Should I be concerned?
In fact, the only reason I wanted to run the simulator is to get an idea of how my app runs on the iPad (of which I don't physically own). What do we think?
If there are no obvious logs, one thing you can do is to add some NSLog statements to each method.
I use these:
NSLog(@"%s", __FUNCTION__);
Then, when I'm done debugging, I comment them out. That way I can see what was the last method the app entered before it stopped.
You should always debug the reason that an app does not behave as expected, as this could be the underlying cause of a much more serious problem, such as a memory corruption that will cause the app to crash all the time for every customer after the moon phase changes just a little bit.
The NSZombiesEnabled argument also helps track down bugs: http://iosdevelopertips.com/debugging/tracking-down-exc_bad_access-errors-with-nszombieenabled.html
Sometimes the simulator gets confused. Delete the content of ~/Library/Application Support/iPhone Simulator/6.1/Applications or thereabouts and try it again.
精彩评论