What is the correct way to use NSURLConnection return data?
What is the difference between the following two code snippets? When I use the first snippet, the requests goes through but data holds 0 bytes, where as in the second case I do get the data. I know the second snippet works but why? I am using synchronous call here.
This one returns 0 bytes of data...
NSData *data = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error];
This one returns correct data...
NSData *data ;
data = [NSURLConnectio开发者_Python百科n sendSynchronousRequest:theRequest returningResponse:&response error:&error];
There's no difference between these two statements. Are you absolutely sure that there's no other modification?
精彩评论