I am trying to fetch data from an URL (in this case an image) and write this data to the disk. I receive the data and everything seems fine. The Debugger even shows that data is written to the disk and it is even the right size. But when I open the photos app I cant find the file. Why?
var fileData: NSData = NSData(contentOfURL: response.URL!)!
var paths: NSArray = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
var documentsDirectory: NSString = paths.objectAtIndex(0) as NSString
var filePath = documentsDirectory.stringByAppendingPathComponent("new.jpg")
fileData.writeToFile(filePath, atomically: true)
I think you can write to the photo app album with UIImageWriteToSavedPhotosAlbum
. Of course you need to convert the data to UIImage first: [UIImage imageWithData: fileData]