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.
Try this code to remove NSTemporaryDirectory files
-(void)deleteTempData
{
NSString *tmpDirectory = NSTemporaryDirectory();
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *cacheFiles = [fileManager contentsOfDirectoryAtPath:tmpDirectory error:&error];
for (NSString *file in cacheFiles)
{
error = nil;
[fileManager removeItemAtPath:[tmpDirectory stringByAppendingPathComponent:file] error:&error];
}
}
and to check data remove or not write code in didFinishLaunchingWithOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];
NSString *tmpDirectory = NSTemporaryDirectory();
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *cacheFiles = [fileManager contentsOfDirectoryAtPath:tmpDirectory error:&error];
NSLog(@"TempFile Count ::%lu",(unsigned long)cacheFiles.count);
return YES;
}