Given, a file of path [[self documentsDirectory] stringByAppendingPathComponent:@"myFiles/aFile.txt"]
, How do I delete a file in my apps documents directory?
views:
157answers:
1
+7
A:
NSFileManager is a very handy tool:
[[NSFileManager defaultManager] removeItemAtPath: pathToFile error: &error];
Ben Gottlieb
2010-02-05 03:53:05
removeItemAtURL:error: is another useful NSFileManager method. I find that URLs are often easier to work with than paths.
John M. P. Knox
2010-07-13 21:12:27