iOS 删除本地文件

xiaoxiao2021-02-28  78

 //删除本地文件

    NSFileManager *fileManger = [NSFileManager  defaultManager];//文件管理器

    NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);

    NSString *documentPath = [paths objectAtIndex:0];

    //更改到待操作的目录下

    [fileManger changeCurrentDirectoryPath:[documentPath  stringByExpandingTildeInPath]];

 

 [fileManger removeItemAtPath:obj.messageName error:nil];// obj.messageName 改成你要删除的文件名

转载请注明原文地址: https://www.6miu.com/read-73295.html

最新回复(0)