I am using a external library and one of my view controller is registering as delegate for a class in that framework. Now, at one place I want to execute some code on this delegate class. I am writing a method for that and calling it on my delegate.
Now, all works fine but I am getting a warning that this newly added method is not part of the protocol.
This is my Class:
@protocol MyExtendedDelegate <LibraryDelegate>
@optional
- (void)actionTaken;
@end
@interface MyController : UITableController <MyExtendedDelegate> {
}
@end
And inside my controller I am registering self as delegate for library controller
LibraryController *libController = [[LibraryController alloc] init];
libController.delegate = self;
Finally, This is the code in a separate class where I am calling this method:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if ([self.libraryController.delegate respondsToSelector:@selector(actionTaken)]) {
[self.libraryController.delegate actionTaken];
}
Here is the warning I am getting:
-- actionTaken not found in protocol
-- NSObject may not respond to actionTaken
I want to get rid of this warning. Any idea.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…