ios - Deleting all the files in the iPhone sandbox (documents folder)? -
is there easy way delete files(images) saved in documents folder of app?
nsfilemanager *filemgr = [[[nsfilemanager alloc] init] autorelease]; nserror *error = nil; nsarray *directorycontents = [filemgr contentsofdirectoryatpath:documentsdirectory error:&error]; if (error == nil) { (nsstring *path in directorycontents) { nsstring *fullpath = [documentsdirectory stringbyappendingpathcomponent:path]; bool removesuccess = [filemgr removeitematpath:fullpath error:&error]; if (!removesuccess) { // error handling ... } } } else { // error handling ... }
Comments
Post a Comment