有没有办法获得将来自Web服务的数据长度?

时间:2011-05-13 05:48:45

标签: web-services

我使用下面的代码来获取来自Web服务的数据长度。

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    [webData setLength: 0];

    NSLog(@"%f",[[NSNumber numberWithLong:[response expectedContentLength]] floatValue]);
}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [webData appendData:data];
    [webData retain];
}

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    NSLog(@"Error : %@",error);
}

-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{

}

0 个答案:

没有答案