I’m having a weird behavior in my app. I’m populating my views with data from the database and sometimes the views are empty and i don’t know the cause. It’s like the database is closed or something so i was thinking to use some delegate methods to close and open the database to see if it fixes the problem. So the question is what of these three methods should i use and if this is a good approach?
applicationWillResignActive
applicationDidEnterBackground
applicationWillTerminate
So those are to close the database, to open the database should i use a notification like:
UIApplicationWillEnterForegroundNotification
Thanks in advance.
Well be aware that
viewDidUnloadcan still be called when your app is in the background and the OS need memory.So when you clear any object in the
viewDidUnloadand not set them in theviewDidLoadthen your views could be empty.