ObjC 中的 long long int
我正在使用这个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自
expectedContentLength
:NSURLResponseUnknownLength
等于-1。您是否尝试过检查内容长度标头?您连接到的服务器可能使用分块传输编码,因此内容长度为无法使用。From the docs on
expectedContentLength
: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.