title: NSNotificationCenter called twice in applicationDidEnterBackground when their is two view controller?
body: <p>I'm using the the <code>NSNotificationCenter.defaultCenter().postNotificationName</code> function with the <code>applicationDidEnterBackground</code> function. So first I add these to <code>AppDelegate.swift</code>:</p>
  
  <pre><code>func applicationDidEnterBackground(application: UIApplication) {
      println("applicationDidEnterBackground")
      NSNotificationCenter.defaultCenter().postNotificationName("com.test.mytest", object: self)
  }
  </code></pre>
  
  <p>And I add these to <code>ViewController.swift</code></p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
      NSNotificationCenter.defaultCenter().addObserver(self, selector: "myTestFunc", name: "com.test.mytest", object: nil)
  }
  
  func myTestFunc () {
      println("CALLED")
  }
  </code></pre>
  
  <p>And up to now, everything is working fine, the console print out the right thing when I enter background:</p>
  
  <pre><code>applicationDidEnterBackground
  CALLED
  </code></pre>
  
  <p>But after I add a new view controller in Storyboard and connect both of them using any of Segue:</p>
  
  <p><img src="https://i.stack.imgur.com/PUBCw.png" alt="storyboard"></p>
  
  <p><img src="https://i.stack.imgur.com/dyeLA.png" alt="storyboard"></p>
  
  <p>And now when I run the app, after I clicked two buttons and then back to the home page, the applicationDidEnterBackground is still calling once but the NSNotificationCenter is called twice:</p>
  
  <pre><code>applicationDidEnterBackground
  CALLED
  CALLED
  </code></pre>
  
  <p>So how can I solve this weird problem?</p>
  
  <p>EDIT</p>
  
  <p>I've also tried this, but still same result:</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
      NSNotificationCenter.defaultCenter().removeObserver(self, name: "com.test.mytest", object: nil)
      NSNotificationCenter.defaultCenter().addObserver(self, selector: "myTestFunc", name: "com.test.mytest", object: nil)
  }
  </code></pre>