我想获取JSON并在互联网可用时将其缓存,如果不存在则使用缓存。我使用了这段代码,但当我离线时,请求的responseString始终为空。 (文件说,它只能如果服务器返回200或300回应离线使用ASIDownloadCache
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDownloadCache:[ASIDownloadCache sharedCache]];
任何想法,以获得高速缓存的数据时,有没有网络连接
谢谢
谢谢!它很棒! – Matthew
非常适合在服务器关闭的情况下返回失效的缓存数据作为最后的手段 –