ios开发 - 获取从http上下载文件的大小

    1. - (void)connectionNSURLConnection *)connection didReceiveResponseNSURLResponse *)response{
    2.     NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
    3.     if(httpResponse && [httpResponse respondsToSelectorselector(allHeaderFields)]){
    4.         NSDictionary *httpResponseHeaderFields = [httpResponse allHeaderFields];
    5.         
    6.         total_ = [[httpResponseHeaderFields objectForKey"Content-Length"] longLongValue];
    7.         
    8.         //NSLog(@"%lld", total_);
    9.     }
    10. }

你可能感兴趣的:(ios开发)