iPhone app runs differently when launched from Xcode
I am working on a game that essentially has two timers to control gameplay. One timer is a CADisplayLink that makes a call to redraw the display (with OpenGL) every frame, so slightly under 60 Hz. The other timer is an NSTimer that updates game logic, which I have tried running anywhere between 30 Hz and 100 Hz.
When I run the program in the iOS simulator, it is laggy and seems to be skipping frames. When I use Xcode to run the program on my phone, it works perfectly without any lag or skipping. When I then run the program from the icon on the home screen of my phone, it runs with lag.
What difference is there between loading the program on my phone and running it from Xcode and launching it from the phone itself? I understand that it is communicating with 开发者_如何学Cthe Xcode debugger, but how could it work BETTER when connected to Xcode?
Lastly, there seems to be much less lag when I run both the game logic and the graphics from the same CADisplayLink. Could having both a display link and an NSTimer really be causing such problems?
精彩评论