开发者

iOS multitasking applicationDidEnterBackground crashes on return

开发者 https://www.devze.com 2023-03-14 18:11 出处:网络
I\'m trying to conform to multitasking on iOS4. I\'m not running in the background, I just want to restore in a running state where possible. I\'m an all GL game.

I'm trying to conform to multitasking on iOS4. I'm not running in the background, I just want to restore in a running state where possible. I'm an all GL game.

During applicationWillResignActive I set flags that stop GL rendering and tidy up and silently pause the game.

During applicationDidEnterBackground I release the screen buffers and call glFinish.

In applicationWillEnterForeground I allocate the buffers again

and in applicationWillEnterForeground I un-pause the game

Now, all these get called and it works. I.e. If I hit the home button the game goes away, if I tap the icon it comes back in the same state. The app doesn't get terminated. This is the same for running small apps and then going back to my app.

However, if I run a large app such as another game and come back I get the last rendered frame come back. A 5 second pause. Then the game reboots, or just drops back to springboard.

I've got logs everywhere, and in the debugger on the failed return I get no calls to either applicationWillEnterForeground or applicationWillEnterForeground, I just get a (gdb).

From what I understand, if the system needs my memory it'll be silently killed. This is fine as I save everything when I enter background. So why do I get the last render frame when I run it again, and why does it only sometimes boot and sometimes crash?

I've followed the guide here: http://developer.apple.com/library/ios/#documentation/3D开发者_StackOverflow社区Drawing/Conceptual/OpenGLES_ProgrammingGuide/ImplementingaMultitasking-awareOpenGLESApplication/ImplementingaMultitasking-awareOpenGLESApplication.html

Has anyone any idea what I'm missing?

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号