c - ObjC 中的 long long int

标签 c objective-c integer long-integer

我正在使用这个 NSURLConnection 委托(delegate)方法

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

它总是显示-1

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

谢谢

最佳答案

来自 expectedContentLength 上的文档:

Return Value

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

NSURLResponseUnknownLength is equals to -1 .您是否尝试过检查内容长度 header ?您要连接的服务器可能使用 chunked transfer encoding , 因此内容长度不可用。

关于c - ObjC 中的 long long int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1833227/

相关文章:

ios - iOS 中未收到 FCM 通知

c - 为什么我们将 INT_MIN 定义为 -INT_MAX - 1?

C:拆分整数并将其转换为 ASCII

python - 在 Python 中使用 C 函数

iphone - SignalR:尝试加载图像时有时没有数据返回

c - 如何从任意虚拟地址转储内存,忽略 SIGSEGV

objective-c - 适用于 iPhone/iPad 的线性回归库或代码片段?

java - 为什么我的代码不从命令行获取输入?

c - C中的嵌套strtok函数问题

将malloc的虚拟地址转换为用户空间的物理地址