Reputation: 15986
Moved failed with error: The operation couldn’t be completed. (Cocoa error 516.)
var paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! String
var getImagePath = paths.stringByAppendingPathComponent("Image.png")
var toImagePath = paths.stringByAppendingPathComponent("Image-"+sWordId+".png")
//let image = UIImage(named: getImagePath)
//i1.image = image
var error: NSError?
let filemgr = NSFileManager.defaultManager()
if filemgr.moveItemAtPath(getImagePath, toPath: toImagePath, error: &error) {
println("Move successful")
} else {
println("Moved failed with error: \(error!.localizedDescription)")
}
Upvotes: 0
Views: 464
Reputation: 236380
That error means that there is already a file with the same name at the destination path.
Upvotes: 1