My problem is that when I am calling the protocol method dataLoading via the delegate, it just doesn't recognize it - giving an expected identifier error.
Here is the protocol/interface file:
#import <Foundation/Foundation.h>
@class LoaderView;
@protocol DataLoaderProtocol <NSObject>
@required
- (void) dataLoading;
- (void) doneLoading;
@end
@interface DataLoader : NSObject {
}
@property (retain) id <DataLoaderProtocol> delegate;
@property (retain, nonatomic) LoaderView *loader;
- (id) initWithDelegate: (id <DataLoaderProtocol>) delegate;
- (void) start;
@end
And here is the implementation file:
#import "DataLoader.h"
#import "LoaderView.h"
@implementation DataLoader
@synthesize delegate = _delegate;
@synthesize loader = _loader;
- (id) initWithDelegate: (id <DataLoaderProtocol>) delegate
{
self.delegate = delegate;
return self;
}
- (void) start
{
NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc]
initWithTarget:self.delegate
selector:@selector([self.delegate dataLoading])
object:nil];
[queue addOperation:operation];
[operation release];
}
@end
The error is at this line: selector:@selector([self.delegate dataLoading])
I'm sure this is a stupid mistake on my part, but I don't understand why it's not recognizing that method, since the delegate is tied in with the protocol...