TCBlobDownloaderDelegate Protocol Reference
Conforms to | NSObject |
Declared in | TCBlobDownloader.h |
Overview
The TCBlobDownloaderDelegate
protocol defines the methods supported by TCBlobDownloader
to notify you of the state of the download.
Instance Methods
download:didFinishWithSuccess:atPath:
Optional. Called when the download is finished or when the operation has been cancelled. The TCBlobDownloader
operation will be removed from TCBlobDownloadManager
just after this method is called.
- (void)download:(TCBlobDownloader *)blobDownload didFinishWithSuccess:(BOOL)downloadFinished atPath:(NSString *)pathToFile
Parameters
- blobDownload
The
TCBlobDownloader
object whose execution is finished.
- downloadFinished
YES
if the file has been downloaded,NO
if not.
- pathToFile
The path where the file has been downloaded.
Availability
1.3
Declared In
TCBlobDownloader.h
download:didReceiveData:onTotal:progress:
Optional. Called on each response from the server while the download is occurring.
- (void)download:(TCBlobDownloader *)blobDownload didReceiveData:(uint64_t)receivedLength onTotal:(uint64_t)totalLength progress:(float)progress
Parameters
- blobDownload
The
TCBlobDownloader
object which received data.
- receivedLength
The total number of already received bytes.
- totalLength
The total number of bytes of the file.
- progress
A value between 0 and 1 defining the progress of the download.
Note
If you pause and restart later a download, the new
TCBlobDownloader
will resume it from where it has stopped (seefileName
property for more explanations). Therefore, you might want to track yourself the total size of the file when you first tried to download it, otherwise thetotalLength
is the actual remaining length to download and might not suit your needs if you do something such as a progress bar.
Availability
1.0
Declared In
TCBlobDownloader.h
download:didReceiveFirstResponse:
Optional. Called when the TCBlobDownloader
object has received the first response from the server.
- (void)download:(TCBlobDownloader *)blobDownload didReceiveFirstResponse:(NSURLResponse *)response
Parameters
- blobDownload
The
TCBlobDownloader
object receiving the first response.
- response
The
NSURLResponse
from the server.
Availability
1.0
Declared In
TCBlobDownloader.h
download:didStopWithError:
Optional. Called when an error occur during the download. If this method is called, the TCBlobDownloader
will be automatically cancelled just after, without deleting the the already downloaded parts of the file. This is done by calling cancelDownloadAndRemoveFile:
- (void)download:(TCBlobDownloader *)blobDownload didStopWithError:(NSError *)error
Parameters
- blobDownload
The
TCBlobDownloader
object which trigerred an error.
- error
The trigerred error.
Availability
1.0
Declared In
TCBlobDownloader.h