title: Objective C: How to check if application is currently active (i.e. user is using it)?
body: <p>I am implementing an APNS push for my app with the following behaviours</p>
  
  <p><strong>1) If app is not active i.e. in background or not launched yet</strong>:</p>
  
  <p>User will receive a pop up message and on click will bring him/her to the 3rd tab in the app (see code below)</p>
  
  <pre><code>-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
  {
  
      self.tabController.selectedIndex = 3;
  
  }
  </code></pre>
  
  <p><strong>2) If app is launch and currently active</strong></p>
  
  <p>No popup alert will be shown and the number of new notifications will show as a number on the 3rd tab</p>
  
  <p><img src="https://i.stack.imgur.com/MwhJw.png" alt="enter image description here"></p>
  
  <p>My question is how can I determine if the user's app is active?
  How and where can I implement the check so that I can set the 2 different behaviours?</p>