Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Hamza Hasan
Courses Plus Student 30 Pointsmove Images in Document Directory
please i need to move the images from folder to another folder in document directory please how can i move these images
the following my code:
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)
}
i have receive this error (fatal error: unexpectedly found nil while unwrapping an Optional value lldb)
thanks advance