开发者

What is the correct way to use NSURLConnection return data?

开发者 https://www.devze.com 2023-02-11 05:24 出处:网络
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 th

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消