프로젝트
GitHub에서 보기
kubatruhlar/AFNetworking-RetryPolicy
소개
Nice category that adds the ability to set the retry interval, retry count and progressiveness.
기타 프로젝트What you can do
- retryCount - How many times to try.
- retryInterval - Time interval between attempts in seconds.
- progressive - Next attempt will always take more time than the previous one. (Uses Exponentiation)
- fatalStatusCodes - These will trigger failure block immediately when received and ends current retry.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original
If a request timed out, you usually have to call that request again by yourself. AFNetworking+RetryPolicy is an objective-c category that adds the ability to set the retry logic for requests made with AFNetworking.
Features
- retryCount - How many times to try.
- retryInterval - Time interval between attempts in seconds.
- progressive - Next attempt will always take more time than the previous one. (Uses Exponentiation)
- fatalStatusCodes - These will trigger failure block immediately when received and ends current retry.
Getting started
- Installing through CocoaPods with
pod 'AFNetworking+RetryPolicy' - Use
#import "AFHTTPSessionManager+RetryPolicy.h"directive.
Want to try it first? Use
pod try AFNetworking+RetryPolicycommand.
Usage
Example
- Simple
GETrequest with AFNetworking+RetryPolicy could look like this:
AFHTTPSessionManager *manager = [AFHTTPSessionManager new];
[manager GET:@"foo" parameters:nil headers:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
NSLog(@"%@", responseObject);
} failure:^(NSURLSessionDataTask *task, NSError *error) {
NSLog(@"%@", error.localizedDescription);
} retryCount:5 retryInterval:2.0 progressive:false fatalStatusCodes:@[@401, @403]];
Log
- Enable to see what is happening by setting the
AFHTTPSessionManager’sretryPolicyLogMessagesEnabledproperty totrue. Disabled by default.
Requirements
- AFNetworking 4.0 or later
- Target iOS 9 or later
- Target OS X/macOS 10.10 or later
- Xcode 11 or later
Old versions
For AFNetworking 3 support
- use version 1.x.
For AFNetworking 2 support*
- use branch
afn2-support. - Installing through CocoaPods with
pod 'AFNetworking+RetryPolicy', git: 'https://github.com/kubatruhlar/AFNetworking-RetryPolicy.git' , branch: 'afn2-support'
*Will not be updated anymore.
For AFNetworking 1 support*
- use branch
afn1-support. - Installing through CocoaPods with
pod 'AFNetworking+RetryPolicy', git: 'https://github.com/kubatruhlar/AFNetworking-RetryPolicy.git' , branch: 'afn1-support'
*Will not be updated anymore.
Author and credit
- This library is open-sourced and maintained by Jakub Truhlář.
- AFNetworking is owned and maintained by the Alamofire Software Foundation.
License
- Like :+1: AFNetworking, this category is published under the MIT License. See LICENSE.md for details.
관련 프로젝트 살펴보기
불러오는 중…