请,我需要将图像从文件夹移动到文档目录中的另一个文件夹,请问如何移动这些图像。
以下我的代码:
let fileManager = NSFileManager.defaultManager()
do {
let document = try fileManager.URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: false)
let getFolders = try fileManager.contentsOfDirectoryAtURL(document, includingPropertiesForKeys: nil, options: .SkipsHiddenFiles)
for folder in getFolders {
if folder.lastPathComponent! == cell.folderNameLabel.text! {
for url in imageUrls {
// ImageUrls is the array of all url which i want to move it to another folder
try fileManager.moveItemAtURL(NSURL(string: url)!, toURL: folder)
}
}
}
}catch {
print(error)
}
我收到此错误:
致命错误:在展开Optional值时意外发现nil LLDB
提前致谢。