title: runtime: UI API called from background thread: -[UIApplication applicationState] must be used from main thread only
body: <p>Mac System: 10.12.6
  SDK: Xcode 9.0
  Deployment Target: iOS 9.0</p>
  
  <p>I'm a pretty new developer, but I persue No Warning in my code.</p>
  
  <p>After I upgrade my Xcode to 9, my code show some warnings not exist before. The most misrable is runtime warning shows below, I know it's from Main Thread Check, and I can make it diappear by setting. But i wonder how to fixed it, I have make all my change UI code in the main thread, just like :</p>
  
  <pre><code>  dispatch_async(dispatch_get_main_queue(), ^{
          [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
      });
  </code></pre>
  
  <p>Here is my screenshots about warnings and Xcode logs.</p>
  
  <p><a href="https://i.stack.imgur.com/osr3o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/osr3o.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/fB8FR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fB8FR.png" alt="enter image description here"></a></p>