title: The file “ ” couldn’t be opened because you don’t have permission to view it
body: <p>I am downloading a file to a folder and I am validating that the file is indeed there in the code, but I am getting the above error. Can someone help me figure out why i dont have permissions to read this file?</p>
  <pre><code>let documentsURL = NSSearchPathForDirectoriesInDomains
  (.DocumentDirectory, .UserDomainMask, true)[0]
  
  let checkValidation = NSFileManager.defaultManager()
  
  if (checkValidation.fileExistsAtPath(documentsURL))
  {
      print(&quot;FILE AVAILABLE&quot;);
  }
  else
  {
      print(&quot;FILE NOT AVAILABLE&quot;);
  }
  
  print(documentsURL)
  
  do{
      let data = try String(contentsOfFile: documentsURL as String,
                            encoding: NSASCIIStringEncoding)
      print(data)
      
  }
  catch let error { print(error) }
  </code></pre>
  <blockquote>
  <p>Error Domain=NSCocoaErrorDomain Code=257 &quot;The file “Documents” couldn’t be opened because you don’t have permission to view it.&quot; UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/7FA4D6A9-2149-4053-BF08-22E94A00AE34/Documents, NSUnderlyingError=0x137807200 {Error Domain=NSPOSIXErrorDomain Code=13 &quot;Permission denied&quot;}}</p>
  </blockquote>