Documents Directory

Only documents and other data that is user-generated, or that cannot otherwise be recreated by your application, should be stored in the <Application_Home>/Documents directory and will be automatically backed up by iCloud.


	NSString *FilePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/users.xml"];

Caches Directory

Data that can be downloaded again or regenerated should be stored in the <Application_Home>/Library/Caches directory. Examples of files you should put in the Caches directory include database cache files and downloadable content, such as that used by magazine, newspaper, and map applications.
e.g.


	NSString *FilePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches/users.xml"];

tmp Directory

Data that is used only temporarily should be stored in the <Application_Home>/tmp directory. Although these files are not backed up to iCloud, remember to delete those files when you are done with them so that they do not continue to consume space on the user’s device.


	//Create temporary URL to record to
	NSString *outputPath = [[NSString alloc] initWithFormat:@"%@%@", NSTemporaryDirectory(), @"output.mov"];
	NSURL *outputURL = [[NSURL alloc] initFileURLWithPath:outputPath];
	NSFileManager *fileManager = [NSFileManager defaultManager];
	if ([fileManager fileExistsAtPath:outputPath])
	{
		NSError *error;
		if ([fileManager removeItemAtPath:outputPath error:&error] == NO)
		{
			//Error - handle if required
		}
	}

	...

	[outputPath release];		
	[outputURL release];