I have a single file named a.caf in the documents directory. I would like to rename it when user types into a UITextField
and presses change (t
To keep this question up-to-date, I'm adding the Swift version as well:
let documentDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! String
let originPath = documentDirectory.stringByAppendingPathComponent("/tmp/a.caf")
let destinationPath = documentDirectory.stringByAppendingPathComponent("/tmp/xyz.caf")
var moveError: NSError?
if !manager.moveItemAtPath(originPath, toPath: destinationPath, error: &moveError) {
println(moveError!.localizedDescription)
}