AFNetworking - do not cache response

前端 未结 8 1519
说谎
说谎 2020-12-08 16:51

I\'m using this code to pull a simple JSON feed from a server:

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.         


        
相关标签:
8条回答
  • 2020-12-08 17:36

    Make long story short, just define your AFNetworking manager:

    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    [manager.requestSerializer setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
    

    Enjoy!

    0 讨论(0)
  • 2020-12-08 17:37

    I don't feel good about it, but here is what works. In the AppDelegate didFinishLaunchingWithOptions:

    NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0
                                                                diskCapacity:0
                                                                    diskPath:nil];
        [NSURLCache setSharedURLCache:sharedCache];
    
    0 讨论(0)
提交回复
热议问题