rickerbh/NSURLConnection-Blocks — pull request #1 by dglancy (2011-12-29 20:48:34+00:00)
Title: Added typedef's for the blocks

For folks who don't like to do inline blocks, these typedef's are helpful to define the success and failure blocks upfront.

Example of how I would use them:

- (void)requestSession {

RequestSuccessBlock successBlock = ^(NSData *date, NSURLResponse *response) {
DLog(@"success");
};

RequestFailureBlock failureBlock = ^(NSData *data, NSError *error) {
DLog(@"failure");
};

NSString *url = [NSString stringWithFormat:SOME_URL , [self email], [self password]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: [NSURL URLWithString: url] cachePolicy: NSURLRequestUseProtocolCachePolicy timeoutInterval: 60.0];
[NSURLConnection asyncRequest:request success:successBlock failure:failureBlock];
}