Game won't exit in iOS

For some reason when running my game on iOS the game won’t exit when it should. It works on Windows. It just shows a black screen and sits there. Judging from the debugger it’s just sitting at this line in SDL_uikitappdelegate.m:

UIApplicationMain(argc, argv, NULL, [SDLUIKitDelegate getAppDelegateClassName]);

I’m calling SDL_DestroyWindow() and SDL_Quit(), but the game still won’t exit. Is there something else I need to do?

If I add a call to exit() as the last thing I do the game seems to properly exit. Is that what I’m supposed to do, or is there still some deeper issue that I need to fix?

Your program does need to terminate itself, just as on every other
platform. That’s what exit() does, though not always gracefully. You
should return from the main() function after cleaning up (freeing/deleting)
all of your dynamically allocated resources.

Jonny DOn Fri, Jan 27, 2012 at 11:39 AM, braddabug2 wrote:

**
If I add a call to exit() as the last thing I do the game seems to
properly exit. Is that what I’m supposed to do, or is there still some
deeper issue that I need to fix?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

http://www.clintharris.net/2009/adventures-in-useless-but-interesting-iphone-esoterica-uiapplicationmain-function-never-returns/

It is correct behavior. Unlike a PC program, you don’t have the user exit
the program from within the program, you simply let them push the home
button when they are done.On Fri, Jan 27, 2012 at 10:04 AM, braddabug2 wrote:

**
For some reason when running my game on iOS the game won’t exit when it
should. It works on Windows. It just shows a black screen and sits there.
Judging from the debugger it’s just sitting at this line in
SDL_uikitappdelegate.m:

UIApplicationMain(argc, argv, NULL, [SDLUIKitDelegate
getAppDelegateClassName]);

I’m calling SDL_DestroyWindow() and SDL_Quit(), but the game still won’t
exit. Is there something else I need to do?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org