title: The file “XXX” doesn’t exist
body: <p>I am trying to download a file use  Foreground internet operation . it successfully download but problem is file not exist in the directory </p>
  
  <p>Code :</p>
  
  <pre><code>   let urlString = "https://joycemusic1.files.wordpress.com/2015/07/fight-song-rachel_platten.pdf"
          let filePath = "Documents/"
  
          if let url = NSURL(string: urlString){
  
              let tast = NSURLSession.sharedSession().downloadTaskWithURL(url, completionHandler: { (NSURL, NSURLResponse, NSError) in
                  if let error = NSError{
                      print(error)
                  }
                  if let locationString = NSURL , let fileLocation = locationString.path {
  
                      //print(fileLocation)
  
                      let fileExists = NSFileManager().fileExistsAtPath("fight-song-rachel_platten.pdf")
  
                      if fileExists == true{
                         try! NSFileManager.defaultManager().moveItemAtPath(fileLocation, toPath: filePath)
                      }
                  }
              })
              tast.resume()
          }
  </code></pre>
  
  <p>download file path is: </p>
  
  <blockquote>
    <p>/Users/twilight/Library/Developer/CoreSimulator/Devices/80CCC33B-817F-46C7-A65E-2B1CAA86D940/data/Containers/Data/Application/43CB754B-4096-47B1-9A97-32D1657E426B/tmp/CFNetworkDownload_EoIzdN.tmp</p>
  </blockquote>
  
  <p>No file found </p>
  
  <p><a href="https://i.stack.imgur.com/VgKxZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VgKxZ.png" alt="enter image description here"></a></p>