I have created URLSession for downloading a file, File is being downloaded correctly no problem with that.
I want to show the percentage count of remain bytes, but the delegate function:
-(void) URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
and its parameter totalBytesExpectedToWrite
always returns -1.
All thing was working fine before few days, there is no change with code but it suddenly stopped sending Expected bytes.
My request code is like:
NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:nil];
NSMutableURLRequest*request = [NSMutableURLRequest requestWithURL:fileUrl];
NSDictionary*param = [[NSDictionary alloc]initWithObjectsAndKeys:@"",@"Accept-Encoding", nil];
[request setAllHTTPHeaderFields:param];
NSURLSessionDownloadTask *downloadTask = [session downloadTaskWithRequest:request];
[downloadTask resume];
is there any change with the api which i am missing? OR any other way around?