TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jun 2015 |
Maintained by Chris McKnight.
Depends on: | |
PromiseKit | ~> 1.5 |
AFNetworking | ~> 1 |
Wrapper for the AFHTTPRequestOperation class to return a PromiseKit promise.
Promises clean up the structure of code and provide better data flow and error handling especially when using asynchronous methods.
AFHTTPRequestOperation+PromiseKit.h
, AFHTTPRequestOperation+PromiseKit.m
,
and AFNetworking-PromiseKit.h
into an XCode project with AFNetworking
and set the appropriate targets.Manual install
#import "AFNetworking-PromiseKit.h"
Cocoapods install
#import <AFNetworking-PromiseKit/AFNetworking-PromiseKit.h>
AFHTTPRequestOperation
operation class method and use the resulting promise. NSMutableURLRequest *request = [[AFClient sharedClient] requestWithMethod:@"GET" path:@"/test.json" parameters:nil];
[AFJSONRequestOperation promise:request].then(^(AFHTTPRequestOperation *operation, id JSON){
NSLog(@"Received: %@", JSON);
}).catch(^(NSError *error){
NSLog(@"Received an error: %@", error);
});
AFNetworking-PromiseKit is licensed under the MIT license. Please see the license for more information.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)