一,删除所有文件:
NSFileManager *fileManager = [NSFileManagerdefaultManager];
NSString *temporaryDirectory =NSTemporaryDirectory();
NSArray *contents = [fileManagercontentsOfDirectoryAtPath:temporaryDirectory error:NULL];
NSEnumerator *e = [contentsobjectEnumerator];
NSString *filename;
while ((filename = [enextObject])) {
[fileManagerremoveItemAtPath:[temporaryDirectorystringByAppendingPathComponent:filename] error:NULL];
}
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *temporaryDirectory = NSTemporaryDirectory();
NSArray *contents = [fileManager contentsOfDirectoryAtPath:temporaryDirectory error:NULL];
NSEnumerator *e = [contents objectEnumerator];
NSString *filename;
while ((filename = [e nextObject])) {
[fileManager removeItemAtPath:[temporaryDirectory stringByAppendingPathComponent:filename] error:NULL];
}