ObjC 中的 long long int

发布于 2024-08-12 17:52:23 字数 332 浏览 2 评论 0原文

我正在使用这个 NSURLConnection Delegate 方法,

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    long long rdata = [response expectedContentLength];
    NSLog(@"Response Length : %lld", rdata);    
}

它总是显示 -1

long long 变量的格式说明符是什么?

谢谢

I am using this NSURLConnection Delegate method

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    long long rdata = [response expectedContentLength];
    NSLog(@"Response Length : %lld", rdata);    
}

its always showing -1

What is the format specifier for long long variable ?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

格子衫的從容 2024-08-19 17:52:23

来自 expectedContentLength

返回值

接收者的预期
内容长度,或
NSURLResponseUnknownLength 如果
无法确定长度。

NSURLResponseUnknownLength 等于-1。您是否尝试过检查内容长度标头?您连接到的服务器可能使用分块传输编码,因此内容长度为无法使用。

From the docs on expectedContentLength:

Return Value

The receiver’s expected
content length, or
NSURLResponseUnknownLength if the
length can’t be determined.

NSURLResponseUnknownLength is equals to -1. Have you tried inspecting the content-length header? The server you're connecting to is likely using a chunked transfer encoding, so the content-length is not available.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文