Objective-C:获取从NSURLResponse加载到网页内的PDF的大小

时间:2011-01-16 15:26:21

标签: objective-c nsurl

如何获得加载到网页内的pdf的大小?通常我使用NSURLResponse中的标题来区分大小,但在这种情况下我不知道该怎么做。我得到的标题看起来像:

response headers: {
"Cache-Control" = "max-age=3600, private, must-revalidate";
"Content-Disposition" = "inline; filename=000164702760379530.pdf";
"Content-Type" = "application/pdf; charset=UTF-8";
Date = "Sun, 16 Jan 2011 14:47:45 GMT";
Pragma = "";
Server = "AtyponWS/7.1";
"Transfer-Encoding" = Identity;
"X-Webstats-Respid" = b0324d930da3307597086eafb0e149c5;

有谁知道如何获得整个页面的大小,包括pdf或只是pdf?

1 个答案:

答案 0 :(得分:0)

请参阅:How to determine the size (in bytes) of a file downloading using NSURLConnection?

您可以使用NSURLResponse方法

[httpResponse expectedContentLength];