My UIViewController registers for notifications which my model component sends out when it has finished downloading content.
The downloading can occur in the background (by using beginBackgroundTaskWithExpirationHandler:) so obviously I don’t want my GUI to attempt to redraw etc. if the download completes in the background.
So I guess I have two choices – 1) the model knows when its in the background/foreground and doesn’t fire the notifications. 2) the UIViewController deregisters for notifications when its in the background.
Option 2) is preferable.
Is there a method on UIViewController that is always called when the app goes into the background? Or will the UIViewController have to register to receive a notification event when the app moves into the background?
(Seems like viewWillDisappear, viewWillUnload etc. don’t get called when the app moves to the background?)
make your view controller register for
UIApplicationDidEnterBackgroundNotificationinview did load… the selector method associated will be called before entering background..