title: What's the better way to addObserver/removeObserver with NSNotificationCenter?
body: <p>I used to <code>addObserver</code> in <code>viewDidLoad:</code> and <code>removeObserver</code> in <code>dealloc:</code>. Code:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      [[NSNotificationCenter defaultCenter] addObserver:self
                                               selector:@selector(refreshData)
                                                   name:AnyNotification
                                                 object:nil];
  }
  
  - (void)dealloc
  {
      [[NSNotificationCenter defaultCenter] removeObserver:self
                                                      name:AnyNotification
                                                    object:nil];
  }
  </code></pre>
  
  <p>But according to some articles said, it's better to <code>addObserver</code> in <code>viewDidAppear:</code> and <code>removeObserver</code> in <code>viewDidDisappear:</code>. Code:</p>
  
  <pre><code>- (void)viewDidAppear:(BOOL)animated
  {
      [super viewDidAppear:animated];
  
      [[NSNotificationCenter defaultCenter] addObserver:self
                                               selector:@selector(refreshData)
                                                   name:AnyNotification
                                                 object:nil];
  }
  
  - (void)viewDidDisappear:(BOOL)animated
  {
      [super viewDidDisappear:animated];
  
      [[NSNotificationCenter defaultCenter] removeObserver:self
                                                      name:AnyNotification
                                                    object:nil];
  }
  </code></pre>
  
  <p>So, what's the better way to addObserver/removeObserver?</p>