Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove tmp directory files of an ios app?

I'm working on an app that uses the iPhone camera and after making several tests I've realised that it is storing all the captured videos on the tmp directory of the app. The captures don`t disappear even if the phone is restarted.

Is there any way to remove all these captures or is there any way to easily clean all cache and temp files?

like image 670
oniglo Avatar asked Feb 08 '12 15:02

oniglo


1 Answers

Yes. This method works well:

+ (void)clearTmpDirectory {     NSArray* tmpDirectory = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:NSTemporaryDirectory() error:NULL];     for (NSString *file in tmpDirectory) {         [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@%@", NSTemporaryDirectory(), file] error:NULL];     } } 
like image 104
Max Meier Avatar answered Oct 12 '22 12:10

Max Meier