//创建文件管理器 |
NSFileManager *fileManager = [NSFileManager defaultManager]; |
//获取路径 |
//参数NSDocumentDirectory要获取那种路径 |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); |
NSString *documentsDirectory = [paths objectAtIndex:0]; |
//更改到待操作的目录下 |
[fileManager changeCurrentDirectoryPath:[documentsDirectory stringByExpandingTildeInPath]]; |
//创建文件fileName文件名称,contents文件的内容,如果开始没有内容可以设置为nil,attributes文件的属性,初始为nil |
[fileManager createFileAtPath:@ "fileName" contents:nil attributes:nil]; |
//删除待删除的文件 |
[fileManager removeItemAtPath:@ "createdNewFile" error:nil]; |
by: 发表于:2017-10-25 10:44:49 顶(0) | 踩(0) 回复
??
回复评论