title: dataWithContentsOfURL returns The operation couldn’t be completed. (Cocoa error 256.)
body: <p>I have found other questions similar but they do not solve my problem.</p>
  
  <p>Here is my code</p>
  
  <pre><code>    NSURL *audioUrlValidation   = [NSURL URLWithString:[sender objectAtIndex:1]];
  
  DLog(@"audio validate nsurl %@", audioUrlValidation);
  
      NSError* error = Nil;
  NSData *data            = [NSData dataWithContentsOfURL:audioUrlValidation options:NSDataReadingUncached error:&amp;error];
  
      if (nil != error) {
          DLog(@"Connection failed! Error %@ - %@", error, [error userInfo]);
      }
      DLog(@"response data %@", data);
  
  NSString *audioValidationResponse = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
  </code></pre>
  
  <p>error that i get </p>
  
  <pre><code>audio validate nsurl  NSURL=http://www.mydomain.com/returntexthtml.php
  
  Connection failed! Error Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x98b4680 {NSURL=http://www.mydomain.com/returntexthtml.php}
  
  response data (null)
  </code></pre>
  
  <p>I know error code 256 is NSFileReadUnknownError, THIS error code does not help at all.</p>
  
  <p>My URL has http:// so that is not the issue either?</p>
  
  <p>The following are the response headers to the request</p>
  
  <pre><code>Connection  keep-alive
  Content-Length  28
  Content-Type    text/html
  Date    Tue, 02 Oct 2012 06:54:58 GMT
  Server  nginx
  Vary    Accept-Encoding
  </code></pre>
  
  <p>What could be going wrong?</p>