TuSDKNetworkOperation Class Reference
| Inherits from | NSOperation |
|---|---|
| Conforms to | NSURLConnectionDataDelegate |
| Declared in | TuSDKNetworkOperation.h |
cacheDuration
default 60 (1 minute)
@property (nonatomic) NSUInteger cacheDurationDeclared 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 imageHeadRequestDurationDeclared In
TuSDKNetworkOperation.h
imageCacheDuration
1 day
@property (nonatomic) NSUInteger imageCacheDurationDeclared 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 requestTimeoutDeclared In
TuSDKNetworkOperation.h
url
Request URL Property @property url
@property (nonatomic, copy, readonly) NSString *urlDeclared In
TuSDKNetworkOperation.h
readonlyRequest
The internal request object @property readonlyRequest
@property (nonatomic, strong, readonly) NSURLRequest *readonlyRequestDeclared In
TuSDKNetworkOperation.h
readonlyResponse
The internal HTTP Response Object @property readonlyResponse
@property (nonatomic, strong, readonly) NSHTTPURLResponse *readonlyResponseDeclared In
TuSDKNetworkOperation.h
readonlyPostDictionary
The internal HTTP Post data values @property readonlyPostDictionary
@property (nonatomic, copy, readonly) NSDictionary *readonlyPostDictionaryDeclared In
TuSDKNetworkOperation.h
HTTPMethod
The internal request object’s method type @property HTTPMethod
@property (nonatomic, copy, readonly) NSString *HTTPMethodDeclared In
TuSDKNetworkOperation.h
HTTPStatusCode
The internal response object’s status code @property HTTPStatusCode
@property (nonatomic, assign, readonly) NSInteger HTTPStatusCodeDeclared In
TuSDKNetworkOperation.h
postDataEncoding
Post Data Encoding Type Property @property postDataEncoding
@property (nonatomic, assign) LSQNKPostDataEncodingType postDataEncodingDeclared In
TuSDKNetworkOperation.h
– setCustomPostDataEncodingHandler:forType:
Set a customized Post Data Encoding Handler for a given HTTP Content Type
- (void)setCustomPostDataEncodingHandler:(LSQNKEncodingBlock)postDataEncodingHandler forType:(NSString *)contentTypeDeclared In
TuSDKNetworkOperation.h
stringEncoding
String Encoding Property @property stringEncoding
@property (nonatomic, assign) NSStringEncoding stringEncodingDeclared In
TuSDKNetworkOperation.h
freezable
Freezable request @property freezable
@property (nonatomic, assign) BOOL freezableDeclared In
TuSDKNetworkOperation.h
error
Error object @property error
@property (nonatomic, readonly, strong) NSError *errorDeclared 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 shouldCacheResponseEvenIfProtocolIsHTTPSDeclared In
TuSDKNetworkOperation.h
shouldNotCacheResponse
Boolean variable that states whether the operation’s response should be cached @property shouldNotCacheResponse
@property (nonatomic, assign) BOOL shouldNotCacheResponseDeclared In
TuSDKNetworkOperation.h
shouldContinueWithInvalidCertificate
Boolean variable that states whether the operation should continue if the certificate is invalid. @property shouldContinueWithInvalidCertificate
@property (nonatomic, assign) BOOL shouldContinueWithInvalidCertificateDeclared In
TuSDKNetworkOperation.h
shouldSendAcceptLanguageHeader
Boolean variable that states whether the request should automatically include an Accept-Language header. @property shouldSendAcceptLanguageHeader
@property (nonatomic, assign) BOOL shouldSendAcceptLanguageHeaderDeclared In
TuSDKNetworkOperation.h
cacheHeaders
Cache headers of the response @property cacheHeaders
@property (strong, nonatomic) NSMutableDictionary *cacheHeadersDeclared In
TuSDKNetworkOperation.h
– setUsername:password:
Authentication methods
- (void)setUsername:(NSString *)name password:(NSString *)passwordDeclared In
TuSDKNetworkOperation.h
– setUsername:password:basicAuth:
Authentication methods
- (void)setUsername:(NSString *)username password:(NSString *)password basicAuth:(BOOL)bYesOrNoDeclared In
TuSDKNetworkOperation.h
clientCertificate
Authentication methods (Client Certificate) @property clientCertificate
@property (copy, nonatomic) NSString *clientCertificateDeclared In
TuSDKNetworkOperation.h
clientCertificatePassword
Authentication methods (Password for the Client Certificate) @property clientCertificatePassword
@property (copy, nonatomic) NSString *clientCertificatePasswordDeclared In
TuSDKNetworkOperation.h
authHandler
Custom authentication handler @property authHandler
@property (nonatomic, copy) LSQNKAuthBlock authHandlerDeclared In
TuSDKNetworkOperation.h
operationStateChangedHandler
Handler that you implement to monitor reachability changes @property operationStateChangedHandler
@property (copy, nonatomic) void ( ^ ) ( TuSDKNetworkOperationState newState ) operationStateChangedHandlerDeclared In
TuSDKNetworkOperation.h
credentialPersistence
controls persistence of authentication credentials @property credentialPersistence
@property (nonatomic, assign) NSURLCredentialPersistence credentialPersistenceDeclared 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 *localNotificationDeclared 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 shouldShowLocalNotificationOnErrorDiscussion
- @seealso
- localNotification
Declared In
TuSDKNetworkOperation.h
– addParams:
Add additional POST/GET parameters to your request
- (void)addParams:(NSDictionary *)paramsDictionaryDeclared In
TuSDKNetworkOperation.h
– addHeader:withValue:
Add additional header
- (void)addHeader:(NSString *)key withValue:(NSString *)valueDiscussion
Add a single additional header. See addHeaders for a full discussion.
Declared In
TuSDKNetworkOperation.h
– addHeaders:
Add additional header parameters
- (void)addHeaders:(NSDictionary *)headersDictionaryDeclared In
TuSDKNetworkOperation.h
– setHeader:withValue:
Set a header, overwriting any value already set.
- (void)setHeader:(NSString *)key withValue:(NSString *)valueDiscussion
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 *)authTypeDeclared In
TuSDKNetworkOperation.h
– addFile:forKey:
Attaches a file to the request
- (void)addFile:(NSString *)filePath forKey:(NSString *)keyDeclared 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 *)mimeTypeDeclared In
TuSDKNetworkOperation.h
– addData:forKey:
Attaches a resource to the request from a NSData pointer
- (void)addData:(NSData *)data forKey:(NSString *)keyDeclared 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 *)fileNameDeclared In
TuSDKNetworkOperation.h
– onCompletion:onError:
Block Handler for completion and error
- (void)onCompletion:(LSQNKResponseBlock)response onError:(LSQNKErrorBlock)errorDeclared In
TuSDKNetworkOperation.h
– addCompletionHandler:errorHandler:
adds a block Handler for completion and error
- (void)addCompletionHandler:(LSQNKResponseBlock)response errorHandler:(LSQNKResponseErrorBlock)errorDeclared In
TuSDKNetworkOperation.h
– onNotModified:
Block Handler for tracking 304 not modified state
- (void)onNotModified:(LSQNKVoidBlock)notModifiedBlockDeclared In
TuSDKNetworkOperation.h
– onUploadProgressChanged:
Block Handler for tracking upload progress
- (void)onUploadProgressChanged:(LSQNKProgressBlock)uploadProgressBlockDeclared In
TuSDKNetworkOperation.h
– onDownloadProgressChanged:
Block Handler for tracking download progress
- (void)onDownloadProgressChanged:(LSQNKProgressBlock)downloadProgressBlockDeclared In
TuSDKNetworkOperation.h
– setUploadStream:
Uploads a resource from a stream
- (void)setUploadStream:(NSInputStream *)inputStreamDeclared In
TuSDKNetworkOperation.h
– addDownloadStream:
Downloads a resource directly to a file or any output stream
- (void)addDownloadStream:(NSOutputStream *)outputStreamDeclared In
TuSDKNetworkOperation.h
– isCachedResponse
Helper method to check if the response is from cache
- (BOOL)isCachedResponseDeclared In
TuSDKNetworkOperation.h
– responseData
Helper method to retrieve the contents
- (NSData *)responseDataDeclared In
TuSDKNetworkOperation.h
– responseString
Helper method to retrieve the contents as a NSString
- (NSString *)responseStringDeclared In
TuSDKNetworkOperation.h
– curlCommandLineString
Helper method to print the request as a cURL command
- (NSString *)curlCommandLineStringDeclared In
TuSDKNetworkOperation.h
– responseStringWithEncoding:
Helper method to retrieve the contents as a NSString encoded using a specific string encoding
- (NSString *)responseStringWithEncoding:(NSStringEncoding)encodingDeclared In
TuSDKNetworkOperation.h
– responseImage
Helper method to retrieve the contents as a UIImage
- (UIImage *)responseImageDeclared 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)responseJSONDiscussion
- @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 ))jsonDecompressionHandlerSee 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 ))jsonDecompressionHandlerSee 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)operationSucceededDeclared In
TuSDKNetworkOperation.h
– operationFailedWithError:
Overridable custom method where you can add your custom business logic error handling
- (void)operationFailedWithError:(NSError *)errorDeclared In
TuSDKNetworkOperation.h
– copyForRetry
Copy this MKNetworkOperation, with the intention of retrying the call.
- (instancetype)copyForRetryDiscussion
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