已移动失败并显示错误:无法完成操作。 (可可错误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)")
}
答案 0 :(得分:1)
该错误表示目标路径上已存在同名文件。