Reputation: 65
How can I stop a request(timeout) in AFNetworking if I started a request but no response data for a while such as 30 seconds
Upvotes: 2
Views: 1596
Reputation: 17429
You need to initialize your NSURLRequest with a timeout value that fits your needs.
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:inURL
cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:30.0];
Then, initialize AFNetworking's AFHTTPRequestOperation
with that initialized NSMutableURLRequest request.
Upvotes: 1