title: How can I detect my app was launched for background fetch in didFinishLaunchingWithOptions method?
body: <p>I want to check whether my app was launched for background fetch in my application delegate's didFinishLaunchingWithOptions. There is nothing in launchOptions dictionary. So is there any way to check it?</p>
  
  <p>I know that I can check <code>applicationState</code>, but for some reason sometimes it returns UIApplicationStateBackground, even if I launch app normally. </p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      if (application.applicationState != UIApplicationStateBackground) {
      // Analytics initialization code
      }
  }
  </code></pre>
  
  <p>I've created breakpoint at Analytics initialization code and sometimes it enters to this block even if I launch app normally!</p>
  
  <p>I know that I can detect the state later when <code>applicationDidBecomeActive</code> or <code>applicationDidEnterBackground</code> will be called. If I will use these approach to detect the state I need to move my Analytics initialization code to some other place. If it remain in <code>application:didFinishLaunchingWithOptions:</code> it will be called every time when my app starts background fetch. So maybe I should just move Analytics initialization code to some other method and don't check <code>applicationState</code> in <code>application:didFinishLaunchingWithOptions:</code>? If so which method I can use for this?</p>