开发者

Warning: -method: not found in protocol

开发者 https://www.devze.com 2023-04-02 19:16 出处:网络
I get this warning every time I compile. WARNING:-method not found in protocol. Here is my code in TableViewController.m file.

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..

0

精彩评论

暂无评论...
验证码 换一张
取 消