title: iOS app applicationWillEnterForeground and it stuck for a while
body: <p>I add this function to post a notification when the app enter foreground:</p>
  
  <pre><code>- (void)applicationWillEnterForeground:(UIApplication *)application
  {
      [[NSNotificationCenter defaultCenter] postNotificationName: @"UIApplicationWillEnterForegroundNotification" object: nil];
  }
  </code></pre>
  
  <p>In my own class:</p>
  
  <pre><code>- (void) handleEnterForeground: (NSNotification*) sender
  {
      [self reloadTableData];
  }
  
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      [[NSNotificationCenter defaultCenter] addObserver: self
                                           selector: @selector(handleEnterForeground:)
                                               name: @"UIApplicationWillEnterForegroundNotification"
                                             object: nil];
  }
  </code></pre>
  
  <p>but the handleEnterForeground: function will called twice, I don't know why. The
  reloadTableData: function will call remote webService , so when the app enter
  foreground, it will stuck for a while.</p>