从文档目录中删除指定的文件
我想从我的应用程序文档目录中删除图像。我写的删除图像的代码是: -(void)removeImage:(NSString *)fileName { fileManager = [NSFileManager defaultManager]; paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); documentsPath = [paths objectAtIndex:0]; filePath = [documentsPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@", fileName]]; [fileManager removeItemAtPath:filePath error:NULL]; UIAlertView *removeSuccessFulAlert=[[UIAlertView alloc]initWithTitle:@"Congratulation:" message:@"Successfully removed" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:nil]; [removeSuccessFulAlert show]; } 其部分工作。该代码从目录中删除文件,但是当我检查目录中的内容时,它仍在其中显示图像名称。我想从目录中完全删除该文件。我应该在代码中进行哪些更改以执行相同的操作?谢谢