标签:
就是写进文件,然后判断是否存在来发起请求或者加载本地文件
代码片段
NSString * htmlResponseStr=[NSString stringWithContentsOfURL:[NSURL URLWithString:urlStr] encoding:NSUTF8StringEncoding error:Nil];
NSString *resourcePath = [ [NSBundle mainBundle] resourcePath];
[_fileManager createDirectoryAtPath:[resourcePath stringByAppendingString:@"/Caches"] withIntermediateDirectories:YES attributes:nil error:nil];
NSString * path=[resourcePath stringByAppendingString:[NSString stringWithFormat:@"/Caches/%d.html",[urlStr hash]]];
[htmlResponseStr writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:nil];
标签:
原文地址:http://www.cnblogs.com/huoxingdeguoguo/p/4721401.html