TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jan 2016 |
Maintained by Kenny Ackerson, Kenny Ackerson.
JXHTTP IS NO LONGER BEING ACTIVELY MAINTAINED. We will be phasing it out of TMTumblrSDK
JXHTTP is a networking library for iOS and OS X. It leverages operation queues and GCD to provide a powerful wrapper for Cocoa's built-in NSURLConnection
object, adding many useful features like block response objects and progress tracking across multiple requests. It strives to be as lightweight and readable as possible, making it easy to use or customize for advanced behavior.
To get started, simply download the latest tag and drop the JXHTTP
folder into your Xcode project. There are zero external dependencies or special compiler flags, just #import "JXHTTP.h"
somewhere convenient. A complete docset is included for use in Xcode or Dash, and available online at jxhttp.com. JXHTTP is also available as a CocoaPod.
JXHTTP requires iOS 5.0 or OS X 10.7 or newer.
JXHTTPOperation offers a number of advantages over using vanilla NSURLConnection
without an operation wrapper:
JXHTTP is production-ready and currently powers the Tumblr SDK; thousands of successful requests were performed while you read this paragraph!
See the included example project for a real-world use case in iOS.
JXHTTPOperation *op = [JXHTTPOperation withURLString:@"https://encrypted.google.com/"];
op.didFinishLoadingBlock = ^(JXHTTPOperation *op) {
NSLog(@"%@", op.responseString);
};
[[JXHTTPOperationQueue sharedQueue] addOperation:op];
JXHTTPOperation *op = [JXHTTPOperation withURLString:@"https://encrypted.google.com/"];
[op startAndWaitUntilFinished];
NSLog(@"%@", op.responseString);
NSURL *postURL = [NSURL URLWithString:@"https://web.site/api/POST"];
NSDictionary *postParams = @{ @"make": @"Ferrari", @"model": @"458 Italia" };
JXHTTPOperation *op = [[JXHTTPOperation alloc] initWithURL:postURL];
op.requestBody = [[JXHTTPFormEncodedBody alloc] initWithDictionary:postParams];
op.requestCachePolicy = NSURLRequestReloadIgnoringLocalAndRemoteCacheData;
op.responseDataFilePath = @"/tmp/downloaded_data";
op.trustedHosts = @[ postURL.host ];
op.performsBlocksOnMainQueue = YES;
op.didSendDataBlock = ^(JXHTTPOperation *op) {
NSLog(@"%lld bytes uploaded so far", op.bytesUploaded);
};
[[JXHTTPOperationQueue sharedQueue] addOperation:op];
JXHTTP was created by Justin Ouellette.
Email [email protected] with questions.