title: iOS: Run singleton instance always in the background (different thread)
body: <p>I have a singleton class that manage the whole Core Data write&amp;read methods and sometimes (due to JSON parsing and multiple objects savings) this singleton (that now runs in the main thread) blocks the UI.</p>
  
  <p>I'm using the follow code to create the Singleton instance:</p>
  
  <pre><code>static MyClass *sharedInstance = nil;
  static dispatch_once_t onceToken;
  dispatch_once(&amp;onceToken, ^{
      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
          sharedInstance = [[MyClass alloc] init];
      });
  });
  return sharedInstance;
  </code></pre>
  
  <p>How do I create this instance in a different thread to have all the database tasks done in the background? Thanks!</p>