FileDelete
程序员必上的开发者服务平台 —— DevStore
FileDelete 是简单的 iOS 类,可以从文档和库目录删除文件和子目录。
使用需要引入:
[FileDelete deleteFileFromDocumentsDirectory:@"helpme" inSubDirectory:nil];[FileDelete deleteFileFromLibraryDirectory:@"helpme" inSubDirectory:@"help/theworld];[FileDelete deleteSubDirectoryFromDocumentsDirectory:@"helpless"];[FileDelete deleteSubDirectoryFromLibraryDirectory:@"Libraryofhelplessness/mine"];
Swift 版本方法:
// Delete filesFileDelete.deleteFileFromDocumentsDirectory("YourFile.extension",subdirectory:"YourDirectory")FileDelete.deleteFileFromLibraryDirectory("YourFile.extension",subdirectory:"YourDirectory")FileDelete.deleteFileFromApplicationSupportDirectory("YourFile.extension",subdirectory:"YourDirectory")FileDelete.deleteFileFromTemporaryDirectory("YourFile.extension",subdirectory:"YourDirectory")FileDelete.deleteFileFromCachesDirectory("YourFile.extension",subdirectory:"YourDirectory")// Delete foldersFileDelete.deleteSubDirectoryFromDocumentsDirectory("YourDirectory")FileDelete.deleteSubDirectoryFromLibraryDirectory("YourDirectory")FileDelete.deleteSubDirectoryFromApplicationSupportDirectory("YourDirectory")FileDelete.deleteSubDirectoryFromTemporaryDirectory("YourDirectory")FileDelete.deleteSubDirectoryFromCachesDirectory("YourDirectory")