title: AFNetworking and singleton
body: <p>probably my question will be stupid. </p>
  
  <p>I've seen a lot of examples and tutorials for applications that using AFNetworking. 
  Many of these use create a singleton Client for interaction with the REST server. 
  For example:</p>
  
  <pre><code>@interface APIClient : AFHTTPClient
  
  + (APIClient *)sharedClient;
  
  @end
  
  @implementation APIClient
  
  + (APIClient *)sharedClient {
      static APIClient *sharedClient = nil;
      static dispatch_once_t onceToken;
      dispatch_once(&amp;onceToken, ^{
          sharedClient = [[APIClient alloc] initWithBaseURL:[NSURL URLWithString:baseUrl]];
      }); 
  
      return sharedClient;
  }
  
  @end
  </code></pre>
  
  <p>But, is it safe to have a singleton for this? If my application is multithreaded is convenient to have a singleton?</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>In this <a href="http://www.raywenderlich.com/59255/afnetworking-2-0-tutorial" rel="nofollow">tutorial</a> uses a class RestfulClass which is a singleton. 
  It is also used a delegate to notify the result of the requests. 
  Is used a delegate ..e this does not seem like the best choice if you are using a singleton, is correct this my thinking? </p>
  
  <p>Suppose  that we have two classes: A and B 
  Both use the singleton and so <code>sharedClient</code> method. A and B can set they self as delegate ... this is wrong because one overwrite the other...
  All methods have no control for the thread safe, is this correct?</p>