我每次编译时都会收到此警告。警告: - 方法:在协议中找不到
警告: - 协议中找不到方法。
这是我在TableViewController.m文件中的代码。
@implementation TableViewController
@synthesize 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;
我能得到这个警告,因为它是一个+类方法:?我怎样才能解决这个问题?
任何帮助将不胜感激。
你确定你需要方法'classMethod'是静态的吗? '+(NSArray *)classMethod:(NSString *)placeId;'=?>' - (NSArray *)classMethod:(NSString *)placeId;' – Nekto