Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i restart an app once it becomes active again?

I have an app that stores data in a coredata db. I save data to the db from a web service when the app is started. The thing is that people can keep their app in the background even for weeks and may see data that is no longer valid. I would like to kind of reinitialize the entire app once it comes from background (a sort of restart, if you will) because i have multiple tabs. Can this be done?

like image 693
Alex Avatar asked Jan 19 '26 14:01

Alex


1 Answers

You don't need to restart the app each time it enters foreground. You can disable "multitasking" by adding this to your project's info.plist

Add a new row and select “Application does not run in background” (or type “UIApplicationExitsOnSuspend”) and then toggle the checkbox.

EDIT: (Thanks to Kevin Ballard) It's better if you check if it's been a long time since the last time it downloaded the data and, in that case, re-download the data. You should only disable "multitasking" when you have a really good reason to do that. This is not that case.

like image 101
Youssef Avatar answered Jan 21 '26 06:01

Youssef



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!