nsurlconnection - response.expectedContentLength allway return -1 -


i have connection use nsurlconnection, want draw progress connection when try print current received data , total data length, went wrong ,response.expectedcontentlength allway return -1, why , happen connection, how can fix

 - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data     {         receiveddatabytes += [data length];         nslog(@"data: %f",receiveddatabytes);         [responsedata appenddata:data];     }      - (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response     {         self.httpstatuscode = [(nshttpurlresponse *)response statuscode];         totalfilesize = response.expectedcontentlength;         nslog(@"total: %lf",totalfilesize);     } 

output:

total: -1.000000 data: 1256.000000 total: -1.000000 data: 1034.000000 total: -1.000000 data: 1127.000000 


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -