+(NSString*)getCacheSize { NSDate* begin = [NSDate date]; NSFileManager* fm = [NSFileManager defaultManager]; __block NSError* error = nil; __block NSUInteger fileSize = 0; //获取Books的缓存 dispatch_sync(queue, ^{ NSArray* subFiles = [fm subpathsAtPath:BOOKHEADERPath([LoginPlugin share].userID)]; NSLog(@"subpath = %@",subFiles); for (NSString* fileName in subFiles) { if ([fileName hasSuffix:@"png"]||[fileName hasSuffix:@"jpg"]) { NSDictionary* dic = [fm attributesOfItemAtPath:BOOKPATH([LoginPlugin share].userID,fileName) error:&error]; NSUInteger size = (error ? 0:[dic fileSize]); fileSize += size; } } }); NSString* cacheString = [NSString stringWithFormat:@"%.1fM",fileSize/(1024.0*1024)]; NSTimeInterval time = [begin timeIntervalSinceNow]; NSLog(@"便利文件耗费时间:%lf",time/60.0); return cacheString; }