Skip to content

Commit

Permalink
Add logs for NSURLSession(Data|Download)TaskDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
0xced authored and kcharwood committed Dec 3, 2015
1 parent 88080eb commit b14e740
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions AFNetworking/AFURLSessionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ - (void)URLSession:(__unused NSURLSession *)session
totalBytesSent:(int64_t)totalBytesSent
totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
{
NSLog(@"ℹ️ %s %@", __PRETTY_FUNCTION__, session);
self.progress.totalUnitCount = totalBytesExpectedToSend;
self.progress.completedUnitCount = totalBytesSent;
}
Expand All @@ -134,6 +135,7 @@ - (void)URLSession:(__unused NSURLSession *)session
task:(NSURLSessionTask *)task
didCompleteWithError:(NSError *)error
{
NSLog(@"ℹ️ %s %@", __PRETTY_FUNCTION__, session);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu"
__strong AFURLSessionManager *manager = self.manager;
Expand Down Expand Up @@ -206,6 +208,7 @@ - (void)URLSession:(__unused NSURLSession *)session
dataTask:(__unused NSURLSessionDataTask *)dataTask
didReceiveData:(NSData *)data
{
NSLog(@"ℹ️ %s %@", __PRETTY_FUNCTION__, session);
NSUInteger length = data.length;
long long expectedLength = dataTask.response.expectedContentLength;
if(expectedLength != -1) {
Expand All @@ -221,6 +224,7 @@ - (void)URLSession:(NSURLSession *)session
downloadTask:(NSURLSessionDownloadTask *)downloadTask
didFinishDownloadingToURL:(NSURL *)location
{
NSLog(@"ℹ️ %s %@", __PRETTY_FUNCTION__, session);
NSError *fileManagerError = nil;
self.downloadFileURL = nil;

Expand All @@ -242,6 +246,7 @@ - (void)URLSession:(__unused NSURLSession *)session
totalBytesWritten:(int64_t)totalBytesWritten
totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
{
NSLog(@"ℹ️ %s %@", __PRETTY_FUNCTION__, session);
self.progress.totalUnitCount = totalBytesExpectedToWrite;
self.progress.completedUnitCount = totalBytesWritten;
}
Expand All @@ -250,6 +255,7 @@ - (void)URLSession:(__unused NSURLSession *)session
downloadTask:(__unused NSURLSessionDownloadTask *)downloadTask
didResumeAtOffset:(int64_t)fileOffset
expectedTotalBytes:(int64_t)expectedTotalBytes {
NSLog(@"ℹ️ %s %@", __PRETTY_FUNCTION__, session);
self.progress.totalUnitCount = expectedTotalBytes;
self.progress.completedUnitCount = fileOffset;
}
Expand Down

0 comments on commit b14e740

Please sign in to comment.