RetriableAFNetworking
Retriable AFNetworking
Cocoapods
Add the following to your project's Podfile:
pod 'RetriableAFNetworking'
Carthage
Add the following to your project's Cartfile:
github "retriable/RetriableAFNetworking"
Example
[sessionManager GET:@"https://api.github.com/repos/retriable/RetriableAFNetworking/readme" headers:nil parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
} failure:^(NSURLSessionDataTask *task, NSError *error) {
} retryAfter:^NSTimeInterval(NSInteger currentRetryTime, NSError *latestError) {
if(![latestError.domain isEqualToString:NSURLErrorDomain]) return 0;
switch (latestError.code) {
case NSURLErrorTimedOut:
case NSURLErrorNotConnectedToInternet:
case NSURLErrorNetworkConnectionLost: return 5;
default: return 0;
}
}];