title: UIApplicationWillEnterForegroundNotification get called more and more
body: <p>I am using this function in my view controllers to recognize if the app is active again and to refresh some data:</p>
  
  <pre><code>[[NSNotificationCenter defaultCenter]
              addObserver:self
                 selector:@selector(becomeActive:)
                     name:UIApplicationWillEnterForegroundNotification
                   object:nil];
  </code></pre>
  
  <p>This works for refreshing after getting active, but everytime the app gets back from background to foreground (inactive to active) it calls the function one more time.</p>
  
  <p>So if I closed and opened the app 4 times, the function will be called 4 times!</p>
  
  <p><em>EDIT</em>: The function will be called this way:</p>
  
  <ol>
  <li>close and open: function called 1 time (that's the way i want it)</li>
  <li>close and open: function called 2 times </li>
  <li>close and open: function called 3 times</li>
  <li>close and open: function called 4 times </li>
  </ol>
  
  <p>But it only have to be called 1 time after getting back in foreground. In some situation the app have to show an alert view after getting active and checking data. This alert view will be shown 4 times when the function will be called 4 times.</p>
  
  <p>In the app delegate this function does nothing, but it is mentioned.</p>
  
  <p>I am using Xcode 4.2 and iOS 5! I also used <code>UIApplicationDidBecomeActive</code>, but it also cause the same problem.</p>