I'm trying to save an image to the disk every time a save button is pressed. This is the code I'm using:
NSArray* documentDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES);
NSString* documentDirectory = [documentDirectories objectAtIndex:0];
NSString* documentDirectoryFilename = [documentDirectory stringByAppendingPathComponent:@"piclogs"];
[pdfData writeToFile:documentDirectoryFilename atomically:YES];
Now, obviously the file to be saved will overwrite the previously saved file every time this method is called. I'm trying to find a way to store every picture taken in there, rather than have it overwritten every time. Does anyone know if there is a simple solution to achieve this? I browsed through the docs but couldn't find anything relevant.
Use NSUUID
or CFUUIDCreate
to create a unique name that you can use for the file.