Andres
Andres

Reputation: 11757

Is there a way of restarting an app when coming back from background?

I want to be able to restart the app when coming back from background. So if the user selects the app again it should start as if it were the first time it's open. I've been googling but couldn't find a way of doing this.

I was thinking in just add the main view of the app in applicationWillEnterForeground, but It would be great if I can deallocate resources.

Upvotes: 0

Views: 277

Answers (1)

DrummerB
DrummerB

Reputation: 40211

You can't restart an app. What you can do is disable background support, so your app always completely terminates when closing.

"...you can explicitly opt out of the background execution model by adding the UIApplicationExitsOnSuspend key to your application’s Info.plist file and setting its value to YES."

Source: Opting Out of Background Execution.

Upvotes: 2

Related Questions