TuSDKNetworkOperation Class Reference
Inherits from | NSOperation |
---|---|
Conforms to | NSURLConnectionDataDelegate |
Declared in | TuSDKNetworkOperation.h |
cacheDuration
default 60 (1 minute)
@property (nonatomic) NSUInteger cacheDuration
Declared In
TuSDKNetworkOperation.h
imageHeadRequestDuration
1 day (HEAD requests with eTag are sent only after expiry of this. Not that these are not RFC compliant, but needed for performance tuning)
@property (nonatomic) NSUInteger imageHeadRequestDuration
Declared In
TuSDKNetworkOperation.h
imageCacheDuration
1 day
@property (nonatomic) NSUInteger imageCacheDuration
Declared In
TuSDKNetworkOperation.h
requestTimeout
if your server takes longer than 30 seconds to provide real data, you should hire a better server developer. on iOS (or any mobile device), 30 seconds is already considered high.
@property (nonatomic) NSUInteger requestTimeout
Declared In
TuSDKNetworkOperation.h
url
Request URL Property @property url
@property (nonatomic, copy, readonly) NSString *url
Declared In
TuSDKNetworkOperation.h
readonlyRequest
The internal request object @property readonlyRequest
@property (nonatomic, strong, readonly) NSURLRequest *readonlyRequest
Declared In
TuSDKNetworkOperation.h
readonlyResponse
The internal HTTP Response Object @property readonlyResponse
@property (nonatomic, strong, readonly) NSHTTPURLResponse *readonlyResponse
Declared In
TuSDKNetworkOperation.h
readonlyPostDictionary
The internal HTTP Post data values @property readonlyPostDictionary
@property (nonatomic, copy, readonly) NSDictionary *readonlyPostDictionary
Declared In
TuSDKNetworkOperation.h
HTTPMethod
The internal request object’s method type @property HTTPMethod
@property (nonatomic, copy, readonly) NSString *HTTPMethod
Declared In
TuSDKNetworkOperation.h
HTTPStatusCode
The internal response object’s status code @property HTTPStatusCode
@property (nonatomic, assign, readonly) NSInteger HTTPStatusCode
Declared In
TuSDKNetworkOperation.h
postDataEncoding
Post Data Encoding Type Property @property postDataEncoding
@property (nonatomic, assign) LSQNKPostDataEncodingType postDataEncoding
Declared In
TuSDKNetworkOperation.h
– setCustomPostDataEncodingHandler:forType:
Set a customized Post Data Encoding Handler for a given HTTP Content Type
- (void)setCustomPostDataEncodingHandler:(LSQNKEncodingBlock)postDataEncodingHandler forType:(NSString *)contentType
Declared In
TuSDKNetworkOperation.h
stringEncoding
String Encoding Property @property stringEncoding
@property (nonatomic, assign) NSStringEncoding stringEncoding
Declared In
TuSDKNetworkOperation.h
freezable
Freezable request @property freezable
@property (nonatomic, assign) BOOL freezable
Declared In
TuSDKNetworkOperation.h
error
Error object @property error
@property (nonatomic, readonly, strong) NSError *error
Declared In
TuSDKNetworkOperation.h
shouldCacheResponseEvenIfProtocolIsHTTPS
Boolean variable that states whether the operation’s response should be cached despite coming from a secured source @property shouldCacheEvenIfProtocolIsHTTPS
@property (nonatomic, assign) BOOL shouldCacheResponseEvenIfProtocolIsHTTPS
Declared In
TuSDKNetworkOperation.h
shouldNotCacheResponse
Boolean variable that states whether the operation’s response should be cached @property shouldNotCacheResponse
@property (nonatomic, assign) BOOL shouldNotCacheResponse
Declared In
TuSDKNetworkOperation.h
shouldContinueWithInvalidCertificate
Boolean variable that states whether the operation should continue if the certificate is invalid. @property shouldContinueWithInvalidCertificate
@property (nonatomic, assign) BOOL shouldContinueWithInvalidCertificate
Declared In
TuSDKNetworkOperation.h
shouldSendAcceptLanguageHeader
Boolean variable that states whether the request should automatically include an Accept-Language header. @property shouldSendAcceptLanguageHeader
@property (nonatomic, assign) BOOL shouldSendAcceptLanguageHeader
Declared In
TuSDKNetworkOperation.h
cacheHeaders
Cache headers of the response @property cacheHeaders
@property (strong, nonatomic) NSMutableDictionary *cacheHeaders
Declared In
TuSDKNetworkOperation.h
– setUsername:password:
Authentication methods
- (void)setUsername:(NSString *)name password:(NSString *)password
Declared In
TuSDKNetworkOperation.h
– setUsername:password:basicAuth:
Authentication methods
- (void)setUsername:(NSString *)username password:(NSString *)password basicAuth:(BOOL)bYesOrNo
Declared In
TuSDKNetworkOperation.h
clientCertificate
Authentication methods (Client Certificate) @property clientCertificate
@property (copy, nonatomic) NSString *clientCertificate
Declared In
TuSDKNetworkOperation.h
clientCertificatePassword
Authentication methods (Password for the Client Certificate) @property clientCertificatePassword
@property (copy, nonatomic) NSString *clientCertificatePassword
Declared In
TuSDKNetworkOperation.h
authHandler
Custom authentication handler @property authHandler
@property (nonatomic, copy) LSQNKAuthBlock authHandler
Declared In
TuSDKNetworkOperation.h
operationStateChangedHandler
Handler that you implement to monitor reachability changes @property operationStateChangedHandler
@property (copy, nonatomic) void ( ^ ) ( TuSDKNetworkOperationState newState ) operationStateChangedHandler
Declared In
TuSDKNetworkOperation.h
credentialPersistence
controls persistence of authentication credentials @property credentialPersistence
@property (nonatomic, assign) NSURLCredentialPersistence credentialPersistence
Declared In
TuSDKNetworkOperation.h
localNotification
notification that has to be shown when an error occurs and the app is in background @property localNotification
@property (nonatomic, strong) UILocalNotification *localNotification
Declared In
TuSDKNetworkOperation.h
shouldShowLocalNotificationOnError
- @abstract Shows a local notification when an error occurs
- @property shouldShowLocalNotificationOnError *
- @discussion
- The default value NO. No notification is shown when an error occurs.
- When set to YES, MKNetworkKit shows the NSError localizedDescription text as a notification when the app is in background and the network operation ended in error.
- To customize the local notification text, use the property localNotification
@property (nonatomic, assign) BOOL shouldShowLocalNotificationOnError
Discussion
- @seealso
- localNotification
Declared In
TuSDKNetworkOperation.h
– addParams:
Add additional POST/GET parameters to your request
- (void)addParams:(NSDictionary *)paramsDictionary
Declared In
TuSDKNetworkOperation.h
– addHeader:withValue:
Add additional header
- (void)addHeader:(NSString *)key withValue:(NSString *)value
Discussion
Add a single additional header. See addHeaders for a full discussion.
Declared In
TuSDKNetworkOperation.h
– addHeaders:
Add additional header parameters
- (void)addHeaders:(NSDictionary *)headersDictionary
Declared In
TuSDKNetworkOperation.h
– setHeader:withValue:
Set a header, overwriting any value already set.
- (void)setHeader:(NSString *)key withValue:(NSString *)value
Discussion
addHeader will append the value to any header already set. If you want to overwrite that value, then use setHeader instead.
Declared In
TuSDKNetworkOperation.h
– setAuthorizationHeaderValue:forAuthType:
Sets the authorization header after prefixing it with a given auth type
- (void)setAuthorizationHeaderValue:(NSString *)token forAuthType:(NSString *)authType
Declared In
TuSDKNetworkOperation.h
– addFile:forKey:
Attaches a file to the request
- (void)addFile:(NSString *)filePath forKey:(NSString *)key
Declared In
TuSDKNetworkOperation.h
– addFile:forKey:mimeType:
Attaches a file to the request and allows you to specify a mime-type
- (void)addFile:(NSString *)filePath forKey:(NSString *)key mimeType:(NSString *)mimeType
Declared In
TuSDKNetworkOperation.h
– addData:forKey:
Attaches a resource to the request from a NSData pointer
- (void)addData:(NSData *)data forKey:(NSString *)key
Declared In
TuSDKNetworkOperation.h
– addData:forKey:mimeType:fileName:
Attaches a resource to the request from a NSData pointer and allows you to specify a mime-type
- (void)addData:(NSData *)data forKey:(NSString *)key mimeType:(NSString *)mimeType fileName:(NSString *)fileName
Declared In
TuSDKNetworkOperation.h
– onCompletion:onError:
Block Handler for completion and error
- (void)onCompletion:(LSQNKResponseBlock)response onError:(LSQNKErrorBlock)error
Declared In
TuSDKNetworkOperation.h
– addCompletionHandler:errorHandler:
adds a block Handler for completion and error
- (void)addCompletionHandler:(LSQNKResponseBlock)response errorHandler:(LSQNKResponseErrorBlock)error
Declared In
TuSDKNetworkOperation.h
– onNotModified:
Block Handler for tracking 304 not modified state
- (void)onNotModified:(LSQNKVoidBlock)notModifiedBlock
Declared In
TuSDKNetworkOperation.h
– onUploadProgressChanged:
Block Handler for tracking upload progress
- (void)onUploadProgressChanged:(LSQNKProgressBlock)uploadProgressBlock
Declared In
TuSDKNetworkOperation.h
– onDownloadProgressChanged:
Block Handler for tracking download progress
- (void)onDownloadProgressChanged:(LSQNKProgressBlock)downloadProgressBlock
Declared In
TuSDKNetworkOperation.h
– setUploadStream:
Uploads a resource from a stream
- (void)setUploadStream:(NSInputStream *)inputStream
Declared In
TuSDKNetworkOperation.h
– addDownloadStream:
Downloads a resource directly to a file or any output stream
- (void)addDownloadStream:(NSOutputStream *)outputStream
Declared In
TuSDKNetworkOperation.h
– isCachedResponse
Helper method to check if the response is from cache
- (BOOL)isCachedResponse
Declared In
TuSDKNetworkOperation.h
– responseData
Helper method to retrieve the contents
- (NSData *)responseData
Declared In
TuSDKNetworkOperation.h
– responseString
Helper method to retrieve the contents as a NSString
- (NSString *)responseString
Declared In
TuSDKNetworkOperation.h
– curlCommandLineString
Helper method to print the request as a cURL command
- (NSString *)curlCommandLineString
Declared In
TuSDKNetworkOperation.h
– responseStringWithEncoding:
Helper method to retrieve the contents as a NSString encoded using a specific string encoding
- (NSString *)responseStringWithEncoding:(NSStringEncoding)encoding
Declared In
TuSDKNetworkOperation.h
– responseImage
Helper method to retrieve the contents as a UIImage
- (UIImage *)responseImage
Declared In
TuSDKNetworkOperation.h
– responseJSON
- @abstract Helper method to retrieve the contents as a NSDictionary or NSArray depending on the JSON contents *
- @discussion
- This method is used for accessing the downloaded data as a NSDictionary or an NSArray. If the operation is still in progress, the method returns nil. If the response is not a valid JSON, this method returns nil. *
- @seealso
- responseJSONWithCompletionHandler:
- (id)responseJSON
Discussion
- @availability
- iOS 5 and above or Mac OS 10.7 and above
Declared In
TuSDKNetworkOperation.h
– responseJSONWithCompletionHandler:
Helper method to retrieve the contents as a NSDictionary or NSArray depending on the JSON contents in the background
- (void)responseJSONWithCompletionHandler:(void ( ^ ) ( id jsonObject ))jsonDecompressionHandler
See Also
also - responseJSON - responseJSONWithOptions:completionHandler:
@availability iOS 5 and above or Mac OS 10.7 and above
Declared In
TuSDKNetworkOperation.h
– responseJSONWithOptions:completionHandler:
Helper method to retrieve the contents as a NSDictionary or NSArray depending on the JSON contents in the background
- (void)responseJSONWithOptions:(NSJSONReadingOptions)options completionHandler:(void ( ^ ) ( id jsonObject ))jsonDecompressionHandler
See Also
also - responseJSON - responseJSONWithCompletionHandler:
@availability iOS 5 and above or Mac OS 10.7 and above
Declared In
TuSDKNetworkOperation.h
– operationSucceeded
Overridable custom method where you can add your custom business logic error handling
- (void)operationSucceeded
Declared In
TuSDKNetworkOperation.h
– operationFailedWithError:
Overridable custom method where you can add your custom business logic error handling
- (void)operationFailedWithError:(NSError *)error
Declared In
TuSDKNetworkOperation.h
– copyForRetry
Copy this MKNetworkOperation, with the intention of retrying the call.
- (instancetype)copyForRetry
Discussion
This means that the request parameters and callbacks are all preserved, but anything related to an ongoing request is discarded, so that a new request with the same configuration can be made.
Declared In
TuSDKNetworkOperation.h