Hi,
I just found out that Application.Quit() only works on PC builds, not iOS. What function is used to quit the application for iOS?
Hi,
I just found out that Application.Quit() only works on PC builds, not iOS. What function is used to quit the application for iOS?
You don’t need it; just press the home button. If the OS needs the RAM it will remove the app from memory at some point.
–Eric
You can also force the app to quit when the home buttonis pressed by adding this key UIApplicationExitsOnSuspend = TRUE in the Info.plist file in XCODE. (make sure it’s set to boolean)
Hi,
i’m using the last version of Unity
I used the function:
to make the application quit.
then it returns to the iOS springboard.
but when i double click on the home button, the application is still in the task
Any idea ???
I don’t know about Application.Quit - by default all apps on ios are suspended. You can use checkbox “Exit on Suspend” (in player settings)
There is no task bar in ios - it is smth like “recently launched”. Use Exit on Suspend, press button, then go in your “task bar” launch again and you will see it starting from scratch (showing splash screen, going to menu, or whatever)
That area is for recently used apps, it doesn’t necessarily mean that it hasn’t exited.
actually thats not true.
While the task screen on android works like this, the iOS one works a bit different and less understandable.
The apps listed there are the ones “kept active”.
But active does not mean they are still running, cause iOS has no general application multitasking, unity applications especially not, but iOS is trying to keep the RAM wired to the application so it does not have to terminate it. But it can happen that it is terminated, when you then click / start an application still in this list, they will get called a special init function in the AppController technically to inform them that they are to resume from suspend. But nearly no application actually supports this resume from death (not even apple ones), games generally not at all as recreating the graphics and runtime state requires that much more data are stored than you want to store
Yes since multitasking, it’s impossible to quit an application, i always have to go to task back and to kill each opened app. it becomes boring, but it’s Apple. they have to change something.
No its not impossible.
The UI Exit on Suspend plist entry is exactly for that (shutdown when home is pressed ie app would go in background) and unity offers a checkbox to enable it.
Well, it’s simple: don’t do it. As I already mentioned, the OS closes apps if it needs RAM, there’s no reason for you to do it manually. Plus, just because the app is in the task bar doesn’t mean it’s “multitasking”, it’s just been used recently, that’s all. So you’re wasting your time if you go in there and “close” apps. Also you don’t use Application.Quit in iOS apps; that’s what the home button is for.
It is true; launch an app that uses UIExitOnSuspend, and look in the task bar (or whatever you want to call it). The app will be there.
–Eric
Well, regardless of style guides, and claims that it is never needed, or a bad idea, I really do need to have iOS apps completely shut themselves down in special cases.
Why?
Because I am making an in-house iOS app that runs other iOS apps for diagnostic purposes. The in-house app need to start lots of app sessions, and allow them to end themselves as needed, without having someone sit there and occasionally do the home button thing.
Is there no way to do that automatically?
Any answer to this?
I think if you add a quit button on your ios app it may be rejected by apple.
I use device detection to show a dedicated quit button on android and none on ios.