On 16.04.2012, at 23:03, Florian Pilz wrote: > The import is done in the ".m"-file of HomeTableViewController. But I just > found a fault in my sample code anyways: the ".h"-file of > HomeTableViewController should have an "@protocol NewFooController" > declaration. > > Corrected sample code for HomeTableViewController.h: > > #import <UIKit/UIKit.h> > @protocol NewFooControllerDelegate; > // warning points to line below > @interface HomeTableViewController : UITableViewController > <NewFooControllerDelegate> > @end
That won't work. When you declare a class as conforming to a protocol, the compiler has to know what methods that protocol contains, so it can make sure to complain if one of the required methods is missing. @protocol Foo only works if you want to declare a variable of type id<Foo> (but not actually send messages to it). It simply tells the compiler "this protocol exists", but not what methods it actually consists of. It's the same as with plain C struct Foo; and struct Foo { int x; int y; }; Only the latter can actually be used (because now the compiler knows that there is a struct named 'Foo'), but you can declare pointers to the former, because for a pointer it only has to know the size of an address, not the size of the struct at that address. Cheers, -- Uli Kusterer "The Witnesses of TeachText are everywhere..." http://www.masters-of-the-void.com _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com