zoukankan      html  css  js  c++  java
  • ios 清理缓存(EGO)

    一段清理缓存的代码例如以下:

    dispatch_async(

    dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0)

    , ^{

                       NSString *cachPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask, YES)objectAtIndex:0];

                        

                        NSArray *files = [[NSFileManager defaultManager] subpathsAtPath:cachPath];

                        NSLog(@"files :%d",[files count]);

                        for (NSString *p in files) {

                           NSError *error;

                           NSString *path = [cachPath stringByAppendingPathComponent:p];

                           if ([[NSFileManagerdefaultManager] fileExistsAtPath:path]) {

                                [[NSFileManagerdefaultManager] removeItemAtPath:patherror:&error];

                            }

                        }

                        [selfperformSelectorOnMainThread:@selector(clearCacheSuccess)withObject:nilwaitUntilDone:YES];});


    -(void)clearCacheSuccess

    {

        NSLog(@"清理成功");

    }

  • 相关阅读:
    .net注册iis
    hdu 1081To The Max
    hdu 1312Red and Black
    hdu 1016Prime Ring Problem
    hdu 1159Common Subsequence
    hdu 1372Knight Moves
    hdu 1686Oulipo
    hdu 1241Oil Deposits
    hdu 1171Big Event in HDU
    hdu 4006The kth great number
  • 原文地址:https://www.cnblogs.com/brucemengbm/p/7224026.html
Copyright © 2011-2022 走看看