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

前端 未结 5 1746
夕颜
夕颜 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:48

    Take a look at Method 1 for a cleaner way to do it: https://stackoverflow.com/a/21238330/435040

    The difference is that I'm using subclassing and I'm not patching AFNetworking's code.

    One thing that I forgot to mention. In that answer I'm only changing the timeout interval, but adding some other caching policy is just 1 more line of code.

提交回复
热议问题