On viewWillAppear: and NSNotificationCenter

viewWillAppear: method can be one of the trickiest methods to understand. According to Apple’s documentation:

This method is called before the receiver’s view is about to be added to a view hierarchy and before any animations are configured for showing the view.

The problem arises when your app consist of a single view controller and you implement this method in hopes to be notified (or check your setup) when the user relaunches your app. Unfortunately viewWillAppearAnimated: only fires in between view controllers. So if you have a root view controller and a detail view controller, it will be called when the user switches from one to another, not when he/she reopens (assuming background state) your application.

Continue reading “On viewWillAppear: and NSNotificationCenter”

On viewWillAppear: and NSNotificationCenter