solve core data conflict caused by updating password entity image

This commit is contained in:
Bob Sun 2017-02-16 13:24:41 +08:00
parent f1b14d794d
commit 83b9762122
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
2 changed files with 26 additions and 1 deletions

View file

@ -178,7 +178,9 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
self?.passwordImage = image
self?.tableView.reloadRows(at: [indexPath], with: UITableViewRowAnimation.automatic)
let imageData = UIImageJPEGRepresentation(image, 1)
self?.passwordEntity?.setValue(imageData, forKey: "image")
if let entity = self?.passwordEntity {
PasswordStore.shared.updateImage(passwordEntity: entity, image: imageData)
}
case .failure(let error):
print(error)
}