0
我試圖將文檔目錄中的文件複製到文檔目錄內的目錄,但出現錯誤無法複製到「文件」,因爲具有相同名稱的項目已經存在。將文檔目錄中的文件複製到文檔目錄中的目錄時出錯
任何幫助,將不勝感激。
這裏是我的代碼:
let documentsPath = NSURL(fileURLWithPath: NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0])
let logsPath = documentsPath.URLByAppendingPathComponent("Logs")
let fileURL = documentsPath.URLByAppendingPathComponent("Database.db")
do {
try NSFileManager.defaultManager().copyItemAtURL(fileURL, toURL: logsPath)
} catch let error1 as NSError{
RZLog.Error ("Error: \(error1.localizedDescription)")
}
沒有人幫忙? –