views:

365

answers:

3

The documentation of NSURLConnection says that there are delegate methods like

connection:willSendRequest:redirectResponse: 

But the documentation doesn't mention which delegate protocol to implement. Well, I assume there just isn't any protocol for the delegate, so everything is just optional?

A: 

look here

sakrist
+7  A: 

It's an informal protocol implemented in NSURLConnection.h as a category on NSObject:

@interface NSObject (NSURLConnectionDelegate)

That means any subclass of NSObject can be a delegate for NSURLConnection. Yes, all delegate methods are optional.

Ole Begemann
A: 

There is not one, and while there probably ought to be for completeness, it is unnecessary. Objective-C works on a concept called Duck typing which basically means if there is a method on an object, even if it is not part of a protocol or header definition a message can still be sent to it.

slf