NetworkDownloadTaskOperation Class Reference
| Inherits from | NetworkTaskOperation : NSOperation |
| Conforms to | NSURLSessionDownloadDelegate |
| Declared in | NetworkDownloadTaskOperation.h NetworkDownloadTaskOperation.m |
Overview
Network Download Task Operation
This operation is instantiated by NetworkManager when performing an download. You will not have to
interact directly with this class.
Tasks
Properties
-
didFinishDownloadingHandlerBlock called when the download finishes.
property -
didResumeHandlerBlock called when download is resumed.
property -
didWriteDataHandlerBlock called as data is downloaded and written to the file.
property
Cancel and resume
-
– cancelByProducingResumeData:Cancel operation, producing
resumeDataif we can. -
– initWithSession:resumeData:Create NetworkdDownloadTaskOperation from resume data.
Other Methods
-
– initWithSession:request:Create NetworkTaskOperation
Properties
didFinishDownloadingHandler
Block called when the download finishes.
@property (nonatomic, copy) DidFinishDownloadingHandler didFinishDownloadingHandlerDiscussion
Uses the following typedef:
typedef void(^DidFinishDownloadingHandler)(NetworkDownloadTaskOperation *operation,
NSURL *location,
NSError *error);
Declared In
NetworkDownloadTaskOperation.hdidResumeHandler
Block called when download is resumed.
@property (nonatomic, copy) DidResumeHandler didResumeHandlerDiscussion
Uses the following typedef:
typedef void(^DidResumeHandler)(NetworkDownloadTaskOperation *operation,
int64_t offset,
int64_t expectedTotalBytes);
Declared In
NetworkDownloadTaskOperation.hdidWriteDataHandler
Block called as data is downloaded and written to the file.
@property (nonatomic, copy) DidWriteDataHandler didWriteDataHandlerDiscussion
Uses the following typedef:
typedef void(^DidWriteDataHandler)(NetworkDownloadTaskOperation *operation,
int64_t bytesWritten,
int64_t totalBytesWritten,
int64_t totalBytesExpectedToWrite);
Declared In
NetworkDownloadTaskOperation.hInstance Methods
cancelByProducingResumeData:
Cancel operation, producing resumeData if we can.
- (void)cancelByProducingResumeData:(void ( ^ ) ( NSData *resumeData ))completionHandlerParameters
- completionHandler
The block that is called, providing any
NSDataobject with the resume data.
Declared In
NetworkDownloadTaskOperation.hinitWithSession:request:
Create NetworkTaskOperation
- (instancetype)initWithSession:(NSURLSession *)session request:(NSURLRequest *)requestParameters
- session
The
NSURLSessionfor which the task operation should be created.
- request
The
NSURLRequestfor the task operation.
Return Value
Returns NetworkTaskOperation.
Declared In
NetworkTaskOperation.hinitWithSession:resumeData:
Create NetworkdDownloadTaskOperation from resume data.
- (instancetype)initWithSession:(NSURLSession *)session resumeData:(NSData *)resumeDataParameters
- session
The
NSURLSessionfor which the download task operation should be crewated.
- resumeData
The
resumeDataprovided bycancelByProducingResumeData:.
Return Value
Returns NetworkDownloadTaskOperation object.
Declared In
NetworkDownloadTaskOperation.h