Chetan sharma
Chetan sharma

Reputation: 388

How to get image from AFNetworking Cache in offline mode

i am new to using AFNetworking, my question is if i fetch one image from server with the help of AFNetworking and stop the application and again start, but second time internet is not available on device so i want to fetch the image from AFNetworking cache if internet is not available, on iPhone device. But i am not getting any correct way the do this, i didn't use AFNetworking before, so i am not understanding how to do this. can any one help me with some explanation or any good and understating example.

Thank in advance

Upvotes: 2

Views: 969

Answers (1)

Suen
Suen

Reputation: 1120

You can find the Cache using cachedImageForRequest in class AFImageCache

If your image attaches to the imageView, you can use imageView's category method

- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholderImage;

in class UIImageView+AFNetworking

Also you can use SDWebImage to manage your images from network

Upvotes: 1

Related Questions