Inherits from NSOperation
Declared in TKHTTPRequest.h

Overview

An TKHTTPRequest object provides support to perform the loading of a URL request.

Tasks

Create a request object

Properties

Callback Delegate

File Download Path

Response Properties

Start request

Properties

JSONFinishedBlock

The block called up the finishing of the request and processing of the JSON response data.

@property (nonatomic, copy) TKJSONCompletionBlock JSONFinishedBlock

Discussion

The block called up the finishing of the request and processing of the JSON response data.

Declared In

TKHTTPRequest.h

JSONResponseBlock

The block called up the completion or failure of the request.

@property (nonatomic, copy) TKJSONResponseBlock JSONResponseBlock

Discussion

The block called up the completion or failure of the request.

Declared In

TKHTTPRequest.h

URL

The request’s URL.

@property (nonatomic, strong) NSURL *URL

Discussion

The request’s URL.

Declared In

TKHTTPRequest.h

URLRequest

The request’s URL Request object.

@property (nonatomic, strong) NSURLRequest *URLRequest

Discussion

The request’s URL Request object.

Declared In

TKHTTPRequest.h

delegate

The delegate to receive start, finish and fail callback selectors.

@property (nonatomic, assign) id delegate

Discussion

The delegate to receive start, finish and fail callback selectors.

Declared In

TKHTTPRequest.h

didFailSelector

The selector called upon the failure of the request.

@property (nonatomic, assign) SEL didFailSelector

Discussion

The selector called upon the failure of the request.

Declared In

TKHTTPRequest.h

didFinishSelector

The selector called upon the finishing of the request.

@property (nonatomic, assign) SEL didFinishSelector

Discussion

The selector called upon the finishing of the request.

Declared In

TKHTTPRequest.h

didStartSelector

The selector called upon the start of the request.

@property (nonatomic, assign) SEL didStartSelector

Discussion

The selector called upon the start of the request.

Declared In

TKHTTPRequest.h

downloadDestinationPath

The final destination for the response data file. Default is nil.

@property (nonatomic, copy) NSString *downloadDestinationPath

Discussion

The final destination for the response data file. Default is nil.

Declared In

TKHTTPRequest.h

error

The error object if the requests ends in failure.

@property (nonatomic, copy) NSError *error

Discussion

The error object if the requests ends in failure.

Declared In

TKHTTPRequest.h

failedBlock

The block called up the failure of the request.

@property (nonatomic, copy) TKBasicBlock failedBlock

Discussion

The block called up the failure of the request.

Declared In

TKHTTPRequest.h

finishedBlock

The block called up the finishing of the request.

@property (nonatomic, copy) TKBasicBlock finishedBlock

Discussion

The block called up the finishing of the request.

Declared In

TKHTTPRequest.h

progressDelegate

The progress delegate must adopt the TKHTTPRequestProgressDelegate protocol. The data source is not retained.

@property (nonatomic, assign) id<TKHTTPRequestProgressDelegate> progressDelegate

Discussion

The progress delegate must adopt the TKHTTPRequestProgressDelegate protocol. The data source is not retained.

Declared In

TKHTTPRequest.h

responseBlock

The block called up the completion or failure of the request.

@property (nonatomic, copy) TKResponseBlock responseBlock

Discussion

The block called up the completion or failure of the request.

Declared In

TKHTTPRequest.h

responseData

The response data of the request.

@property (readonly, nonatomic) NSData *responseData

Discussion

The response data of the request.

Declared In

TKHTTPRequest.h

responseHeaders

The response headers of the request.

@property (nonatomic, strong) NSDictionary *responseHeaders

Discussion

The response headers of the request.

Declared In

TKHTTPRequest.h

showNetworkActivity

The request will show the network indicator in the status bar when set to YES. Default is YES.

@property (nonatomic, assign) BOOL showNetworkActivity

Discussion

The request will show the network indicator in the status bar when set to YES. Default is YES.

Declared In

TKHTTPRequest.h

startedBlock

The block called upon the start of the request.

@property (nonatomic, copy) TKBasicBlock startedBlock

Discussion

The block called upon the start of the request.

Declared In

TKHTTPRequest.h

statusCode

The status code of the request.

@property (nonatomic, assign) NSInteger statusCode

Discussion

The status code of the request.

Declared In

TKHTTPRequest.h

tag

An integer that you can use to identify request objects in your application.

@property (nonatomic, assign) NSUInteger tag

Discussion

An integer that you can use to identify request objects in your application.

Declared In

TKHTTPRequest.h

temporaryFileDownloadPath

The destination for the response data to be written to during the request connection. Default is nil.

@property (nonatomic, copy) NSString *temporaryFileDownloadPath

Discussion

The destination for the response data to be written to during the request connection. Default is nil.

Declared In

TKHTTPRequest.h

Class Methods

isNetworkInUse

Returns YES if there are any active requests, otherwise NO.

+ (BOOL)isNetworkInUse

Return Value

YES if there are any active requests, otherwise NO.

Discussion

Returns YES if there are any active requests, otherwise NO.

Declared In

TKHTTPRequest.h

requestWithURL:

Returns a newly created request with a URL.

+ (instancetype)requestWithURL:(NSURL *)URL

Parameters

URL

The URL for the new request.

Return Value

The newly created request object.

Discussion

Returns a newly created request with a URL.

Declared In

TKHTTPRequest.h

requestWithURL:JSONResponseHandler:

Returns a newly created request with a URL.

+ (instancetype)requestWithURL:(NSURL *)URL JSONResponseHandler:(TKJSONResponseBlock)responseHandler

Parameters

URL

The URL for the new request.

responseHandler

The JSON response handler for the request.

Return Value

The newly created request object.

Discussion

Returns a newly created request with a URL.

Declared In

TKHTTPRequest.h

requestWithURL:responseHandler:

Returns a newly created request with a URL and response handler. Immediately starts async request.

+ (instancetype)requestWithURL:(NSURL *)URL responseHandler:(TKResponseBlock)responseHandler

Parameters

URL

The URL for the new request.

responseHandler

The response handler for the request.

Return Value

The newly created request object.

Discussion

Returns a newly created request with a URL and response handler. Immediately starts async request.

Declared In

TKHTTPRequest.h

requestWithURLRequest:

Returns a newly created request with a NSURLRequest object.

+ (instancetype)requestWithURLRequest:(NSURLRequest *)request

Parameters

request

The NSURLRequest for the new request.

Return Value

The newly created request object.

Discussion

Returns a newly created request with a NSURLRequest object.

Declared In

TKHTTPRequest.h

setShouldUpdateNetworkActivityIndicator:

Sets the rule that future requests will change the Network Indicator in the status bar

+ (void)setShouldUpdateNetworkActivityIndicator:(BOOL)shouldUpdate

Parameters

shouldUpdate

YES if the network indicator should change upon new requests, otherwise NO.

Discussion

Sets the rule that future requests will change the Network Indicator in the status bar

Declared In

TKHTTPRequest.h

Instance Methods

initWithURL:

Returns a newly initialized request with a URL.

- (instancetype)initWithURL:(NSURL *)URL

Parameters

URL

The URL for the new request.

Return Value

The newly created request object.

Discussion

Returns a newly initialized request with a URL.

Declared In

TKHTTPRequest.h

initWithURLRequest:

Returns a newly initialized request with a NSURLRequest object.

- (instancetype)initWithURLRequest:(NSURLRequest *)request

Parameters

request

The NSURLRequest for the new request.

Return Value

The newly created request object.

Discussion

Returns a newly initialized request with a NSURLRequest object.

Declared In

TKHTTPRequest.h

startAsynchronous

Causes the request to begin loading data, if it has not already.

- (void)startAsynchronous

Discussion

Causes the request to begin loading data, if it has not already.

Declared In

TKHTTPRequest.h