Latest 0.0.5
License MIT
Platforms ios 6.0, osx 10.8, requires ARC
Dependencies AFNetworking, ObjcAssociatedObjectHelpers


An iOS category adding retry functionality to requests made using AFNetworking 2

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like AFNetworking in your projects. See the "Getting Started" guide for more information. You can install it with the following command:

$ gem install cocoapods

To integrate AFNetworking-AutoRetry into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'AFNetworking+AutoRetry'

Then, run the following command:

pod install


Import the libraries at the top of your .m file

#import <AFNetworking/AFHTTPRequestOperationManager.h>
#import <AFNetworking+AutoRetry/AFHTTPRequestOperationManager+AutoRetry.h>

Then, in your function:

// setup POST data
NSDictionary *parameters = @{@"key":@"value"};
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
// set the network timeout duration to 30 seconds
manager.requestSerializer = [[AFHTTPRequestSerializerWithTimeout alloc] initWithTimeout:30];
[manager POST:@"" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
    // success, parse the response here
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    // failure, e.g. network error
} autoRetry:3];

where 3 is the number of retries. Similar for GET cases.


If you encounter any questions or issues, please use the tag afnetworking-autoretry to ask in Stack Overflow. If you think you found a bug, please report it at Issues.


AFNetworking is owned and maintained by the Alamofire Software Foundation.
AFNetworking-AutoRetry is created by Shai Ohev Zion and now maintained by Shivan Raptor and Daniel Jankovič.

Latest podspec

    "name": "AFNetworking+AutoRetry",
    "version": "0.0.5",
    "summary": "Auto Retries for AFNetworking requests",
    "description": "                   A minimal category which extends AFNetworking, currently only AFHTTPRequestOperationManager, ton                   add retries to the requests. you can specify the number of retries, and when they are reachedn                   your failure block is called (instead of at the first time using only AFNetworking)n",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Shai Ohev Zion": "[email protected]"
    "source": {
        "git": "",
        "tag": "v0.0.5"
    "platforms": {
        "ios": "6.0",
        "osx": "10.8"
    "requires_arc": true,
    "source_files": "*.{h,m}",
    "dependencies": {
        "AFNetworking": [
            "~> 2"
        "ObjcAssociatedObjectHelpers": []

Pin It on Pinterest

Share This