Giter Site home page Giter Site logo

wquzhongrensan / afnetworking-autoretry Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shaioz/afnetworking-autoretry

0.0 2.0 0.0 61 KB

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

License: MIT License

Objective-C 97.76% Ruby 2.24%

afnetworking-autoretry's Introduction

AFNetworking-AutoRetry

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

Usage

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:@"http://www.example.com/api" 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.

##Communication 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.

##Credits 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č.

afnetworking-autoretry's People

Contributors

hoya avatar johnboiles avatar jold avatar limey avatar shaioz avatar shivanraptor avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.