Monday, 26 August 2013

Delete document directory all data



- (void)delete_document_directory_all_data 
{
NSString *dirPath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSFileManagerfilemanager = [[NSFileManager alloc] init];
NSDirectoryEnumeratordet = [filemanager enumeratorAtPath: dirPath];
NSErrorerror = nil;
BOOL deletePath;
NSString* file;
while (file = [det nextObject])
    {
        deletePath = [filemanager removeItemAtPath:[dirPath stringByAppendingPathComponent:file] error:& error];
if (! deletePath && error)
            {NSLog(@"error  : %@"error);}
}

}