title: NSCocoaErrorDomain Code=256
body: <p>I have been stuck with this for a while and don't seem to get around this. </p>
  
  <p>I am trying to read the contents of an URL as a string from an URL, But i get a weird </p>
  
  <blockquote>
    <p>Error -> Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" </p>
  </blockquote>
  
  <p>My code :</p>
  
  <pre><code>fetchedString = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"www.example.com/iphone"] encoding:NSUTF8StringEncoding error:&amp;error];                                     
      NSLog(@"%@",fetchedString);
  
      // if there is something wrong with the URL 
      if (error) {
          NSLog(@"Error -&gt; %@", error);
          return ;
      }
  </code></pre>
  
  <p>What am I doing wrong? I tried using getting as NSData as well, but I get null back. </p>