smartsanja
smartsanja

Reputation: 4540

Terminate the app running in background after a specific time?

Can I terminate the app running in background after a specific time? Eg: after runing app 24hrs in background, i want to kill the app. then, when you launch the app, app should load as fresh..(like viewDidLoad ..)

Can I do this in iOS?

Upvotes: 0

Views: 662

Answers (1)

Xval
Xval

Reputation: 938

As pointed out in other discussion, terminating your app might get your app refused by Apple.

It's not really an answer, but you could simply override

  • (void)applicationDidEnterBackground:(UIApplication *)application

to save the date when the user exit your app.

  • (void)applicationWillEnterForeground:(UIApplication *)application

And compare the current date with the last one to know if you should restart your app or not. By restart your app i presenting your user your first UIViewController (and potentially cleaning some data).

Upvotes: 2

Related Questions