views:

44

answers:

1

hi all

i just wanted to know if this is the right way to check if a sendsynchronousrequest was successful:

NSData* returnData = [NSURLConnection sendSynchronousRequest:req returningResponse:nil error:nil];
if(returnData == nil)
{
    //code showing an alertView for example
}
else
{
    //do somthing else
}

thanks in advance for your feedback
sean

A: 

I think you want to pass something in for your error:

NSData* returnData = [NSURLConnection sendSynchronousRequest:req returningResponse:nil error:&error];

if(error != 0)
  // good to go
else
  // error

But I could be wrong, just quickly glanced at it.

I did see this post though.. I think he's asking a similar thing:

http://discussions.apple.com/thread.jspa?threadID=1647649

David Nelson