Frage

I want my app to be "restarted" every time I close it. When I open another app or quit the app, and launch it again, it should start at the beginning again. So it's always up to date.

Hope you understand what I mean.

War es hilfreich?

Lösung

Apple's documentation

If you do not want your app to run in the background at all, you can explicitly opt out of background by adding the UIApplicationExitsOnSuspend key (with the value YES) to your app’s Info.plist file. When an app opts out, it cycles between the not-running, inactive, and active states and never enters the background or suspended states. When the user presses the Home button to quit the app, the applicationWillTerminate: method of the app delegate is called and the app has approximately 5 seconds to clean up and exit before it is terminated and moved back to the not-running state.

Opting out of background execution is strongly discouraged but may be the preferred option under certain conditions. Specifically, if coding for the background adds significant complexity to your app, terminating the app might be a simpler solution. Also, if your app consumes a large amount of memory and cannot easily release any of it, the system might kill your app quickly anyway to make room for other apps. Thus, opting to terminate, instead of switching to the background, might yield the same results and save you development time and effort.

However, as a user of iOS apps, I must urge you to reconsider, because it really sucks to not be able to switch to send a tweet.

Andere Tipps

You want to set the 'application does not run in background' key in your app's plist file.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top