I want to store pictures taken from camera and video recordings from my application in a separate folder in temporary directories for a while. And as the task is being completed, they shall be going to save into the database.
How do I save pictures taken from camera & video recording files in a separate folder in temp directories?
You are looking for this to get tot he caches folder to store temporary files:
NSString* path = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory,
NSUserDomainMask,
YES) lastObject];
From there you can use NSFileManager
to create and remove the directories you want. And store files just as to any other part of a file system. Just be aware that the system will purge the caches directory now and then.
So never rely on file remaining, nor disappearing, between restarts of your app.
try this:
NSString *tmpDirectory = NSTemporaryDirectory();
NSString *tmpFile = [tmpDirectory stringByAppendingPathComponent:@"temp.txt"];
NSLog(@"Temp File:%@", tmpFile);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With