I am using a GET for getting a data from Server, Want to implement a progressbar, for that i tried to capture expectedContentLength in the didReceiveResponse delegate method. How can it can be solved?
NSString* serverUrl = @"https:testURL";
receivedData = [[NSMutableData alloc] initWithLength:0];
NSURL* url =[NSURL URLWithString:[serverUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
[theRequest setValue:@"identity" forHTTPHeaderField:@"Accept-Encoding"];**(I tried it after seeing other solutions over Web)**
[NSURLConnection connectionWithRequest:theRequest delegate:self];
...
- (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[receivedData setLength:0];
expectedBytes = [response expectedContentLength];
}