NSURLConnection on iOS doesn't try to cache objects larger than 50KB

爱⌒轻易说出口 提交于 2019-11-29 04:10:23

I'd suggest using ASIHTTPRequest library instead of NSURLRequest:

http://allseeing-i.com/ASIHTTPRequest/How-to-use

It has a robust caching API:

http://allseeing-i.com/ASIHTTPRequest/How-to-use#using_a_download_cache

I'm not sure how it works for a UIWebvieuw, but when you use a NSURLRequest the maximum size of the file depends on how you initialize the URLCache (initWithMemoryCapacity:(NSUInteger)memoryCapacity ...)

I'd suggest using the three20 library and TTURLRequest. This appears to have good caching for large data sizes, since it's used for Facebook and in particular the pictures.

TTURLRequest is pretty much a drop in replacement for a NSURLRequest, so should be easy to move to, and doesn't have much dependency on the rest of Three20

Check out my fork of AFNetworking that includes a custom class of NSURLCache that supports disk saving: https://github.com/steipete/AFNetworking/tree/disk-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!