title: iOS singleton shared instance and loading remote json data
body: <p>This is my situation:</p>
  
  <pre><code>// data.m
  @property (nonatomic, strong) NSMutableArray *jsonData;
  
  + (Data *)sharedData
  {
      static Data *sharedData;
      static dispatch_once_t onceToken;
      dispatch_once(&amp;onceToken, ^
      {
          _sharedData = [[Data alloc] init];
      });
  
      return _sharedData;
  }
  
  - (id)init
  {
      self = [super init];
      if (self)
      {
          [self clear];
          [self load]; // here i start loading my remote JSON data and fill self.jsonData
      }
  
      return self;
  }
  </code></pre>
  
  <p>and I have</p>
  
  <pre><code>// main.m 
  [Data sharedData].jsonData; // this return nil
  </code></pre>
  
  <p>the jsonData return nil , i think because the request to the server is not done yet..
  How can I do for wait till the remote request is done?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT:</p>
  
  <p>here's my load method</p>
  
  <pre><code>[[ApiClient sharedClient] loadDataWithSuccess:^(NSMutableArray *data)
  {     
      self.jsonData = data;
  }
                                           fail:^(NSString *errorMessage)
  {
      NSLog(@"%@", errorMessage);
  }];
  </code></pre>
  
  <p><code>loadDataWithSuccess</code> returns void.</p>