title: iOS Remove observer from notification: Can I call this once for all observers? And even if there are none?
body: <p>I'm registering three observers in most of my view controllers. Some have more, some less but I want to include part of the registration and unregistration process in a parent class. Is there any problem with calling the unregistering even if there is no observer? And is one call to unregister enough for all three observers?</p>
  
  <pre><code>- (void)registerForKeyboardNotifications
  {
      [[NSNotificationCenter defaultCenter] addObserver:self
                                               selector:@selector(keyboardWasShown:)
                                                   name:UIKeyboardWillShowNotification object:nil];
  
      [[NSNotificationCenter defaultCenter] addObserver:self
                                               selector:@selector(keyboardWillBeHidden:)
                                                   name:UIKeyboardWillHideNotification object:nil];
  
      [[NSNotificationCenter defaultCenter] addObserver:self
                                               selector:@selector(applicationWillEnterBackground:)
                                                   name:UIApplicationWillResignActiveNotification
                                                 object:nil];
  }
  
  - (void)viewWillDisappear:(BOOL)animated
  {
      [super viewWillDisappear:animated];
  
      //Has to be unregistered always, otherwise nav controllers down the line will call this method
      [[NSNotificationCenter defaultCenter] removeObserver:self];
  }
  
  - (void)dealloc
  {
      [[NSNotificationCenter defaultCenter] removeObserver:self];
  }
  </code></pre>