首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

ios 剔除文件

2012-09-25 
ios 删除文件?- (void)removeFileWithName:(NSString *)fileName{// you need to write a function to get

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目录,

热点排行