CocoaPods trunk is moving to be read-only. Read more on the blog, there are 10 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Apr 2015 |
Maintained by Jose Camallonga.
Using NSURLSession and the rest of the new iOS 7 & Mavericks foundation network classes, wrapped with syntactic sugar and convenience. No need to inherit and make a singleton. The category will keep track of your session with a session name.
A incredibly light weight and source-readable HTTP client. Plugginable Serializers on top of builting foundation classes NSURLSession and NSURLSessionTask. Life-cycle callbacks (think before_filter or after_filter) Upload & Download progress blocks. Choose delegates and/or blocks Convenience serializers (JSON out of the box by default) to get started fast.
pod 'BETURLSession'#import <BETURLSession.h> NSURLSession * session = [NSURLSession bet_sessionWithName:@"Random" baseURLString:@"http://httpbin.org"];
NSMutableArray * bigData = @[].mutableCopy;
for (NSInteger i = 0; i!=50000; i++) [bigData addObject:@(i)];
NSURLSessionTask * task = [session bet_taskPOSTResource:@"post"
withParams:@{@"POST" : bigData}
completion:^(BETResponse *response) {
NSLog(@"POST completed with code %@ & error %@",
@(response.HTTPURLResponse.statusCode),
response.error
);
}];
BETURLSessionTaskProgressHandlerBlock (^progressHandlerWithName)(NSString *) = ^BETURLSessionTaskProgressHandlerBlock(NSString * name) {
return ^(NSURLSessionTask *task, NSInteger bytes, NSInteger totalBytes, NSInteger totalBytesExpected) {
NSLog(@"%@ : %@ <-> %@ <-> %@", name, @(bytes), @(totalBytes), @(totalBytesExpected));
};
};
[task bet_setUploadProgressHandler:progressHandlerWithName(@"Upload")];
[task bet_setDownloadProgressHandler:progressHandlerWithName(@"Download")];
[task resume];
If you end up using BETURLSession in a project, we'd love to hear about it.
email: [email protected]
twitter: @ScreenTwitt
BETURLSession is © 2013 Screen Interaction and may be freely
distributed under the MIT license.
See the LICENSE.md file.