title: -[NSNull length]: unrecognized selector sent to JSON objects
body: <p>I'm developing an iOS 5.0+ app with latest SDK.</p>
  
  <p>I get a very strange error with this code:</p>
  
  <pre><code>- (NSMutableURLRequest*)setupRequestWithService:(NSString*)service andMethod:(NSString*)method
  {
      NSString* url = [NSString stringWithFormat:@"%@%@.svc/%@", serverUrl, service, method];
  
      NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
  
      // Set authentication token.
      NSLog(@"???????????? %@", authenticationToken);
      if (authenticationToken == nil)
          NSLog(@"NULL AUTHTOKEN");
      if ([authenticationToken isEqual:[NSNull null]])
          NSLog(@"NSNULL AUTHTOKEN");
      if (request == nil)
          NSLog(@"NULL REQUEST");
      [request addValue:authenticationToken forHTTPHeaderField:REQUEST_HEADER_AUTH_TOKEN];
  
      return request;
  }
  </code></pre>
  
  <p>This is my log:</p>
  
  <pre><code>???????????? &lt;null&gt;
  NSNULL AUTHTOKEN
  -[NSNull length]: unrecognized selector sent to instance 0x3b5a5090
      *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance 0x3b5a5090'
  </code></pre>
  
  <p>It seems that <code>authenticationToken</code> is <code>NULL</code>. But I don't understand that, if <code>authenticationToken</code> is <code>NULL</code> why I don't see <code>NULL AUTHTOKEN</code> on the log.</p>
  
  <p>I get this error the second time I run that method, the first time, I don't get any error. This is my log:</p>
  
  <pre><code>???????????? (null)
  NULL AUTHTOKEN
  </code></pre>
  
  <p>By the way:</p>
  
  <pre><code>NSString* authenticationToken;
  </code></pre>
  
  <p><strong>Any advice?</strong></p>
  
  <p>Maybe there is a <code>Memory Leak</code> somewhere...</p>