On Mar 5, 2010, at 7:54 PM, Stuart Malin wrote:

> I expected the sendSynchronousRequest approach to return an NSHTTPURLResponse 
> object without an error because, according to the docs, the synchronous 
> method is built on top of the asynchronous methods.

Yes, but its semantics are different; it's more limited because it doesn't 
support a delegate. In particular, you can't do HTTP authentication with the 
synchronous version. Therefore, any 401 response by the server is a fatal error 
that gets returned to you. But in the async case, a 401 is a recoverable 
situation because you can implement the authentication method in the delegate 
API to handle it.

In general, the async API does not treat HTTP status conditions (4xx, 5xx) as 
errors; instead you can check for these in your didReceiveResponse method. But 
the synchronous version does return those as NSErrors.

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to