How to get NSURLSession to return Content-Length(http header) from server. Objective-c, ios
问题 I have spend many hours trying the various ideas found in posts on this question with no success. When I use curl I get the desired header : Content-Length. Here is my latest attempt(found somewhere on SO): - (void) trythis { NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession *session = [NSURLSession sessionWithConfiguration:config]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:myURL]; request.HTTPMethod = @