Methods not declared in Logger.h file


In the Helper Object example, methods connection:didReceiveData: and connection:didFailWithError: of the Logger class are not declared in Logger.h. Is this a typical practice for these type of objects, or is it an omission.

And how come the example works without them? I expected the methods to be private. Can you point me to some more info about the public/private-ness of methods.

Really enjoying the book so far.




They are the delegate methods of the NSURLConnection class. So you just need to provide their implementations in the class whose instance is acting as the delegate; you don’t (need to) declare them in the header file because they are not part of the external interface - but they are part of the implementation.

If you like you can do something like this in the implementation file:

// Foo.m

@interface Foo () < NSURLConnectionDelegate >

@implementation Foo
// NSURLConnectionDelegate methods
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data


Great way to say it. I got it now, I think. Thanks