How to quit the SDL app on iOS?

Hello,

The SDL app looks like this:

int main(int argc, char **argv)
{

SDL_Quit();
return 0;
}

The ipad shows a black screen when the app quit.

As a workaround, the app can quit after the “return 0” was replaced
with “exit(0)”. But what is the elegant way to quit a SDL app on
iPad?

Thanks.

Best regards,

You’re not supposed to quit an iOS app according to apple guidelines, so
apple doesn’t support any elegant way, like fading out or minimizing or
whatever. That said, I quit my app by simpley posting a quit event and when
I encounter it in the event loop, I break from the loop and fall to the
return statement at the bottom of main.

I had an idea of somehow taking a screenshot of the pad/pod before game
start and fading to the screenshot while I quit, but I didn’t follow up
with it, and feel as though apple would cite it as a security hazards.
They’re very fickle.On Sun, Mar 11, 2012 at 1:56 AM, Spark Around wrote:

Hello,

The SDL app looks like this:

int main(int argc, char **argv)
{

SDL_Quit();
return 0;
}

The ipad shows a black screen when the app quit.

As a workaround, the app can quit after the “return 0” was replaced
with “exit(0)”. But what is the elegant way to quit a SDL app on
iPad?

Thanks.

Best regards,


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

Thank you for your repy. That’'s is very helpful. I have just checked
the iOS Human Interface Guidlines and knew the reason now.
Since we should not quit an iOS application programmatically, what is
the code we should write after SDL_Quit() ? “return 0” ?.
If we use “return 0” , the application will show a black screen. The
user will also interpret this as a unexpected crash surely.

Will you show some code for “posting a quit event”? Do you mean that
it will work just like what the “Home button” does on ipad?

If I understand it correctly, you show the screenshot before
SDL_Quit. That’s a a “fake” quit. Just wait the user to press Home
key. Am I right?
What is the code after the SDL_Quit in your application?On Sun, Mar 11, 2012 at 8:54 PM, Jeremy Jurksztowicz wrote:

You’re not supposed to quit an iOS app according to apple guidelines, so
apple doesn’t support any elegant way, like fading out or minimizing or
whatever. That said, I quit my app by simpley posting a quit event and when
I encounter it in the event loop, I break from the loop and fall to the
return statement at the bottom of main.

I had an idea of somehow taking a screenshot of the pad/pod before game
start and fading to the screenshot while I quit, but I didn’t follow up with
it, and feel as though apple would cite it as a security hazards. They’re
very fickle.

On Sun, Mar 11, 2012 at 1:56 AM, Spark Around <@Spark_Around> wrote:

Hello,

The SDL app looks like this:

int main(int argc, char **argv)
{

SDL_Quit();
return 0;
}

The ipad shows a black screen when the app quit.

As a workaround, the app can quit after the “return 0” was replaced
with “exit(0)”. ?But what is the elegant way to quit a SDL app on
iPad?

Thanks.

Best regards,


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


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

Spark Around wrote:

Thank you for your repy. That’'s is very helpful. I have just checked
the iOS Human Interface Guidlines and knew the reason now.
Since we should not quit an iOS application programmatically, what is
the code we should write after SDL_Quit() ? “return 0” ?.
If we use “return 0” , the application will show a black screen. The
user will also interpret this as a unexpected crash surely.

Will you show some code for “posting a quit event”? Do you mean that
it will work just like what the “Home button” does on ipad?

If I understand it correctly, you show the screenshot before
SDL_Quit. That’s a a “fake” quit. Just wait the user to press Home
key. Am I right?
What is the code after the SDL_Quit in your application?

You’re not supposed to do any of this and eventually one day Apple
will decide this is important and you’ll get rejected apps.

WHAT you are supposed to do – and this is why some of us keep talking
about the callback patch – is respond properly to the iOS events that
tell your app to suspend/resume or free up memory.

If you get suspend/resume, stop doing things or start them up, or, if
you want, tear everything down and then start up again. If you get the
free memory, then tear everything down and restart it on the next resume.

These need to be in a callback so your app can basically be dead (it
can’t wait in a loop, that’s also not what you are supposed to do, no
generic background processes – only the accepted ones. There’s a good
reason for this, it slows down phones and drains batteries.)

[>] Brian

Thanks.On Mon, Mar 12, 2012 at 9:50 PM, Brian Barnes wrote:

Spark Around wrote:

Thank you for your repy. That’'s is very helpful. I have just checked
the iOS Human Interface Guidlines and knew the reason now.
Since we should not ?quit an iOS application programmatically, what is
the code we should write after SDL_Quit() ? “return 0” ?.
If we use “return 0” , the application will show a black screen. The
user will also interpret this as a unexpected crash surely.

Will you show some code for “posting a quit event”? Do you mean that
it will work just like what the “Home button” does on ipad?

If I understand it correctly, ?you show the screenshot before
SDL_Quit. That’s a a “fake” quit. Just wait the user to press Home
key. Am I right?
What is the code after the SDL_Quit in your application?

You’re not supposed to do any of this and eventually one day Apple will
decide this is important and you’ll get rejected apps.

WHAT you are supposed to do – and this is why some of us keep talking about
the callback patch – is respond properly to the iOS events that tell your
app to suspend/resume or free up memory.

If you get suspend/resume, stop doing things or start them up, or, if you
want, tear everything down and then start up again. ?If you get the free
memory, then tear everything down and restart it on the next resume.

These need to be in a callback so your app can basically be dead (it can’t
wait in a loop, that’s also not what you are supposed to do, no generic
background processes – only the accepted ones. ?There’s a good reason for
this, it slows down phones and drains batteries.)

[>] Brian


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