SDURLCache with AFNetworking and offline mode not working

前端 未结 3 1777
情深已故
情深已故 2020-12-23 13:13

I\'m using AFNetworking and SDURLCache for all my networking operations.

I have SDURLCache set like this:

SDUR         


        
3条回答
  •  半阙折子戏
    2020-12-23 13:31

    It sounds like you want the request to succeed, even though the cache says the data has expired and should be retrieved from the server. You may have some luck setting the cache policy (different policy for online vs. offline) of certain requests where you'd rather use stale data than fail.

    NSMutableURLRequest -> setCachePolicy

    It looks like NSURLRequestReturnCacheDataDontLoad is the policy you want for offline mode.

    Hope that helps!

提交回复
热议问题