title: File path saved to CoreData but NSData works only on first call
body: <p>I'm downloading a picture from internet and storing its data locally then saving the path in my CoreData, this way:</p>
  
  <pre><code>       getDataFromUrl(url!) { (data, response, error)  in
              dispatch_async(dispatch_get_main_queue()) { () -&gt; Void in
                  guard let data = data where error == nil else { return }
                  print(response?.suggestedFilename ?? "")
                  print("Download Finished")
                      let filename = self.getDocumentsDirectory().stringByAppendingPathComponent(userKey as! String + ".png")
                      data.writeToFile(filename, atomically: true)
                      user.setValue(filename, forKey: "avatar")
                      do {
                          try managedContext.save()
                      }
                      catch let error as NSError  {
                          print("Could not save \(error), \(error.userInfo)")
                      }
                  }
              }
  </code></pre>
  
  <p>The save does seem to work (I debugged by printing the data received and the data inside the file once copied and I don't have any <code>managedContext</code> error).</p>
  
  <p>On the next view, I do use a <code>UITableView</code> and on <code>cellForRowAtIndexPath</code></p>
  
  <pre><code>    let path = authorArray.objectAtIndex(indexPath.row).objectAtIndex(0).objectForKey("avatar")! as! String
      let name = authorArray.objectAtIndex(indexPath.row).objectAtIndex(0).objectForKey("name")
      do {
          let data = try NSData(contentsOfFile: path, options: NSDataReadingOptions())
          let image = UIImage(data: data)
          cell.profilePicture.image = image
          cell.profilePicture.layer.cornerRadius = cell.profilePicture.layer.cornerRadius / 2;
          cell.profilePicture.layer.masksToBounds = true;
      }
      catch {
          print("failed pictures")
      }
  </code></pre>
  
  <p>The thing is I get the photo on my <code>cell.profilePicture</code> but as soon as I do any modification elsewhere and relaunch my application from xCode, I get the error message. The pictures path did not change but the datas obtained from it are <code>nil</code>. I can't find a reason why it does work until I update the code. Any solutions to make it work everytime ?</p>