ios 删除文件
?
- (void)removeFileWithName:(NSString *)fileName{ // you need to write a function to get to that directory NSString *filePath = [[self stringForDocumentDirectroy]stringByAppendingPathComponent:fileName]; NSFileManager *fileManager = [NSFileManager defaultManager]; if ([fileManager fileExistsAtPath:filePath]) { NSError *error; if (![fileManager removeItemAtPath:filePath error:&error]) { NSLog(@"Error removing file: %@", error); } else { NSLog(@"successed removed file"); } }}
?其中?[self stringForDocumentDirectroy]是document目录,