Warning: -method: not found in protocol
I get this warning every time I compile.
WARNING: -method not found in protocol.
Here is my code in TableViewController.m file.
@implementation TableViewController
@synthesi开发者_开发问答ze delegate;
- (NSArray *) placeId
{
NSArray *places = [self.delegate classMethod: placeId];
// WARNING SHOWS UP HERE.
}
//Here is my code in TableViewController.h file.
@class TableViewController;
@protocol TableViewControllerDelegate
+ (NSArray *) classMethod: (NSString *) placeId;
@end
@interface TableViewController : UITableViewController
{
id <TableViewControllerDelegate> delegate;
}
@property (assign) id <TableViewControllerDelegate> delegate;
@end
//My code in SubClass.h
#import "TableViewController.h"
@interface SubClass: NSObject <TableViewControllerDelegate>
+ (NSArray *) classMethod: (NSString *) placeId;
Do I get this warning because it is a + classMethod:? How can I get around this?
Any help would be greatly appreciated.
Read this stackOverflow thread..your method 'classMethod' is a Class Method (how ironic) and you cannot call it using an object of that class..
Use
[SubClass classMethod];
to call that function..
精彩评论