//創(chuàng)建文件管理對象
NSFileManager *fileManger = [NSFilemanager defaultManger];
//找到沙盒路徑
NSArray *path = NSSearchPathForDirectoriesInDomain(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *documentDirectory = [path objectAtIndex:0];
// 把文件夾下面的 文件放到數(shù)組里面
NSArray *contents = [fileManager contentOfDirectoryAtPath:documentsDirectory error:NULL];
// 創(chuàng)建遍歷路徑對象
NSEnumerator *e = [contents objectEnumerator];
NSString *fileName;
while ((fileName = [e nextObject])){
[fileManager removeItemAtPath:[documentsDirectory stringByAppendingPathComponent:filename] error:NULL];
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者