views:

33

answers:

1

Hello guys, I have a little problem; I have this protocol defined as so below:

@protocol someProtocol <NSObject>

- (void) changedStoryForIndexPath: (NSIndexPath *) indexPath;

@end

I have it defined in a file named "ListViewController.h", logically I have to import the header in another file like: #import "ListViewController.h" then in my @interface declare the protocol in the protocol tags like <someProtocol> right? When do I do so then compile, the compiler (on Xcode 4.0 and 3.2.4) tells me that it can't find the protocol declaration. You can see the error here: http://www.freeimagehosting.net/uploads/5ff0c99bf7.png

Thank You guys!

A: 

You should have the protocol in a different header file.

SomeProtocol.h:

@protocol someProtocol <NSObject>
- (void) changedStoryForIndexPath: (NSIndexPath *) indexPath;
@end

And import it in the ListViewController class.

#import "SomeProtocol.h"
vakio
Thanks @vakio, weird, it's the first time I have to make a separate protocol header. I normally just declare the protocol in a header and voila. Thanks!
G33kz0r