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

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

    dispatch_async(

    dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)

    , ^{

                        NSString *cachPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMaskYESobjectAtIndex:0];

                        

                        NSArray *files = [[NSFileManager defaultManagersubpathsAtPath:cachPath];

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

                        for (NSString *p in files) {

                            NSError *error;

                            NSString *path = [cachPath stringByAppendingPathComponent:p];

                            if ([[NSFileManager defaultManagerfileExistsAtPath:path]) {

                                [[NSFileManager defaultManagerremoveItemAtPath:path error:&error];

                            }

                        }

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

    -(void)clearCacheSuccess

    {

        NSLog(@"清理成功");

    }

     颜色部分可以改变路径位置。

  • 相关阅读:
    SharePoint2013配置网站邮箱1
    使用正则表达式验证注册页面(用户名,密码,确认密码,邮箱,手机号)
    邮箱和电话验证
    js页面自动刷新和自动跳转
    B. Secret Combination
    B. Queue
    A. Crazy Town
    C. New Year Book Reading
    A. Little Pony and Expected Maximum
    B. Fox And Two Dots
  • 原文地址:https://www.cnblogs.com/zhangyang17/p/3772712.html
Copyright © 2011-2022 走看看