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

Cancel and resume

Other Methods

Properties

didFinishDownloadingHandler

Block called when the download finishes.

@property (nonatomic, copy) DidFinishDownloadingHandler didFinishDownloadingHandler

Discussion

Uses the following typedef:

typedef void(^DidFinishDownloadingHandler)(NetworkDownloadTaskOperation *operation,
                                           NSURL *location,
                                           NSError *error);

Declared In

NetworkDownloadTaskOperation.h

didResumeHandler

Block called when download is resumed.

@property (nonatomic, copy) DidResumeHandler didResumeHandler

Discussion

Uses the following typedef:

typedef void(^DidResumeHandler)(NetworkDownloadTaskOperation *operation,
                                int64_t offset,
                                int64_t expectedTotalBytes);

Declared In

NetworkDownloadTaskOperation.h

didWriteDataHandler

Block called as data is downloaded and written to the file.

@property (nonatomic, copy) DidWriteDataHandler didWriteDataHandler

Discussion

Uses the following typedef:

typedef void(^DidWriteDataHandler)(NetworkDownloadTaskOperation *operation,
                                   int64_t bytesWritten,
                                   int64_t totalBytesWritten,
                                   int64_t totalBytesExpectedToWrite);

Declared In

NetworkDownloadTaskOperation.h

Instance Methods

cancelByProducingResumeData:

Cancel operation, producing resumeData if we can.

- (void)cancelByProducingResumeData:(void ( ^ ) ( NSData *resumeData ))completionHandler

Parameters

completionHandler

The block that is called, providing any NSData object with the resume data.

Declared In

NetworkDownloadTaskOperation.h

initWithSession:request:

Create NetworkTaskOperation

- (instancetype)initWithSession:(NSURLSession *)session request:(NSURLRequest *)request

Parameters

session

The NSURLSession for which the task operation should be created.

request

The NSURLRequest for the task operation.

Return Value

Returns NetworkTaskOperation.

Declared In

NetworkTaskOperation.h

initWithSession:resumeData:

Create NetworkdDownloadTaskOperation from resume data.

- (instancetype)initWithSession:(NSURLSession *)session resumeData:(NSData *)resumeData

Parameters

session

The NSURLSession for which the download task operation should be crewated.

resumeData

The resumeData provided by cancelByProducingResumeData:.

Return Value

Returns NetworkDownloadTaskOperation object.

Declared In

NetworkDownloadTaskOperation.h