I have an app that list items from the server.
It has a local storage for those items.
The idea is that the app will always shows, at least, the items in the local cache, while refreshing from the server every time this particular controller/view is presented.
So, on the ViewWillAppear
I'm synchronously loading the items from my local storage
AND on ViewDidLoad
I'm asynchronously requesting the items from the server, if I get new items, the view is refreshed.
This works fine.
The problem comes when I press home in the iphone and my app is sent to background, when it comes back to the foreground I was expecting ViewDidLoad
to execute, but that is not the case.
Is there any handler on the view I can use to pull the items from the server?
Is WillEnterForeground
my only option?
How would you do this?
Thanks,
R.
Posts
WillEnterForeground is the right way to do that, but you can use NSNotificationCenter to do it instead of modifying your app delegate code:
Awesome! I was hoping there was a way to subscribe to App level notifications within the scope of the view.
Very neat!
Thanks,
R.