- Home /
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?
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
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
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
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.
Answer by Fattie · Jul 28, 2012 at 12:30 PM
it's surprising lot's of iOS programmers didn't quickly yell this answer at you!!
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!!
Your answer
Follow this Question
Related Questions
bad quality icon on iOS 1 Answer
Question reguarding testing my IOS build in Xcode 0 Answers
iOS App Store Size 1 Answer
Veeery small iOS app 1 Answer
Sound Recorder app in Unity for IOS 0 Answers