How do I set a request timeout and cache policy in AFNetworking 2.0?

前端 未结 5 1740
夕颜
夕颜 2021-02-01 17:08

I\'m following the given example code

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:@\"http://example.com/resour         


        
5条回答
  •  情歌与酒
    2021-02-01 17:45

    I'm a bit lazy to categorize or subclass. You can access the manager's request serializer directly:

    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.requestSerializer.timeoutInterval = INTERNET_TIMEOUT;
    manager.requestSerializer.cachePolicy = NSURLRequestReloadIgnoringLocalAndRemoteCacheData;
    

提交回复
热议问题