title: handling launching options and local notifications correctly
body: <p>I'm not absolotly sure about how to deal with the different states of handling a local notification (or a push for that matter).</p>
  
  <p>these are the different scenarios as far as I understand them (correct me if I'm wrong):</p>
  
  <p>a. app was in the foreground</p>
  
  <pre><code>    - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{}
  </code></pre>
  
  <p>is getting called and: application.applicationState == UIApplicationStateActive</p>
  
  <p>b. app was in the background</p>
  
  <pre><code>    - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{}
  </code></pre>
  
  <p>is getting called and: application.applicationState == UIApplicationStateInactive</p>
  
  <p>c. the app was terminated so:</p>
  
  <pre><code>    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{}
  </code></pre>
  
  <p>is getting called first and afterwords:</p>
  
  <pre><code>    - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{}
  </code></pre>
  
  <p>is getting called where application.applicationState == UIApplicationStateActive (since it became active some time after didFinishLanching...</p>
  
  <p>In each of these 3 scenarios I should act differently:</p>
  
  <p>a. if the app was in the foreground, i would like to display an alert that shows the notificaiton body, and push some view controllers on the stack if the user dismisses the alert with a proceed button.</p>
  
  <p>b. if the app was in the background, and the user pressed on the alert then i would like to automatically push the view controllers to the stack, since the user's pressing on the alert indicates he wants to follow it's meaning.</p>
  
  <p>c. same scenarios as b. the user pressed on the alert and expects to see the relevant views.</p>
  
  <p>My Question is how/where should I push the relevant views to the navigationViewController and how to display the alert when receiving the notification in the foreground?</p>
  
  <p>The problem is that scenario c contains scenario a. this means, after didFinishlaunching got called (never mind if I handled the notification there or not) then didRecieveLocalNotification is getting called (as if I got the notification while in the foreground), but in this case i would not want to display an alert..</p>
  
  <p>Am I Wrong about the assumptions to begin with?</p>