I’ve a class named ContentController. I create its instance from ViewController. The first fellow fetches some data from my remote server, does something on it. It then pass the information to ViewController which shows something good to the user. So far so good.
Now, the problem is while using the AppDelegate. When the application tries to enter in the background mode, I want to access the same instance (of ContentController). And save few attributes on the device. And this is not working.
Would you please help me ?
To save property values on applicationDidEnterBackground: you can add a notification observer in your class’es viewDidLoad method like this:
In viewDidUnload you should add this:
Also add these two methods in your class .m-file (below you can see example from one of my applications):
And this method will load data from your file, call in in your viewDidLoad:
This method is needed to get file name: