x


iPhone exits app when game ends?

I see posts that say that you can't exit on the iPhone and that the 'home' button does it.

But with the iPhone now doing multitasking the home button doesn't exit the game. How do I end (terminate) the game when the game is over?

Currently when one loses my game I play an end animation with repeating music. If the 'home' button is hit you back to the iOS. But if you tap the game icon you are back at the end animation and music of my game. 2 days later and tapping the game icon returns to the end of game animation and music.

One can force close the by double click of 'home' button and then tapping and holding the game icon until the '-' sign next to the running game appears. But this isn't really what is good or convenient for the user.

I want the player to be able to return to the game after the 'home' button is hit while the game is going on. But when the game is complete and after my end-game animation sequence I want to exit the game so the player can restart.

How can this be done?

more ▼

asked Jul 27 '12 at 09:46 PM

rsud gravatar image

rsud
100 15 19 24

It's my understanding that iOS does not allow for this, their apps just keep running in the background until it needs the memory for something else.. You should build in a reset function for going back to the start menu after end animation/music

Jul 27 '12 at 09:50 PM Seth Bergman

Is it possible to get Unity to restart the game?

Jul 27 '12 at 09:53 PM rsud

in Android, you can quit.. But I don't think iOS gives the option, at least that's my understanding.. But just do something like this in a script on your final scene:

function Update(){

if(!movie.isPlaying() && !audio.isPlaying())

Application.LoadLevel(0);// title screen scene

}

I may be wrong, but this is just what I've heard

Jul 27 '12 at 10:01 PM Seth Bergman

an interesting "suggestion" here:

http://gamedev.stackexchange.com/questions/17709/can-an-ios-application-have-an-explicit-quit-button

someone recommends intentionally crashing the app with a line of bad code, to the user it just seems to close :D

Jul 28 '12 at 12:33 AM Seth Bergman

Why don't you just have a button the player can tap that restarts the game? It's pretty weird that you'd want to make the player exit the game just to restart.

Jul 28 '12 at 12:36 AM Eric5h5
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

it's surprising lot's of iOS programmers didn't quickly yell this answer at you!!

alt text

click build then player settings .. that's your answer! it's that simple.

You can read about this extensively..

eg, http://devgirl.org/2011/06/24/exit-vs-suspend-your-ios-application/

or at Apple, long URL at Apple's docu...

scroll down to "UIApplicationExitsOnSuspend key in its Info.plist"

Note that:

"I want the player to be able to return to the game after the 'home' button is hit while the game is going on. But when the game is complete and after my end-game animation sequence I want to exit the game so the player can restart."

in the iPhone universe, all of that is not possible.

(1) you cannot quit iFone apps from within the app. the user can only quit them using the plastic round button. this is an extremely basic aspect of iFone apps: as a developer, you simply cannot exit iFone apps, it's that simple. give that there are now, what 1/2 million iFone apps and 88 gazillion ifones this is well-understood and established! I guess anyone with an ifone (pad, pod, etc) understands that you cant quite an ifone app from within the app. (if you use the ridiculous trick of crashing the app, apple will simply reject it of course, if they catch the trick, or, they'll just instantly pull it from the store if someone notices later.)

(2) regarding the player returning after going to another app and playing on, that is fairly automatically handled by Unity, read the long URL above for full gory and annoying details!!

suspend.jpg (22.3 kB)
more ▼

answered Jul 28 '12 at 12:30 PM

Fattie gravatar image

Fattie
19k 57 86 146

Thxs for this info!

Aug 10 '12 at 01:47 PM rsud
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1953
x70
x57

asked: Jul 27 '12 at 09:46 PM

Seen: 646 times

Last Updated: Aug 10 '12 at 01:47 PM