objective c - Protocol method not being recognized when called via delegate -
objective c - Protocol method not being recognized when called via delegate -
my problem when calling protocol method dataloading
via delegate, doesn't recognize - giving expected identifier
error.
here 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 implementation file:
#import "dataloader.h" #import "loaderview.h" @implementation dataloader @synthesize delegate = _delegate; @synthesize loader = _loader; - (id) initwithdelegate: (id <dataloaderprotocol>) delegate { self.delegate = delegate; homecoming 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 @ line: selector:@selector([self.delegate dataloading])
i'm sure stupid error on part, don't understand why it's not recognizing method, since delegate tied in protocol...
the way wrote selector:@selector([self.delegate dataloading])
wrong seek using : selector:@selector(dataloading)
instead.
objective-c ios delegates protocols
Comments
Post a Comment