Iphone,我该如何修复此警告:' - responseToSelector:'在协议中找不到

Jul*_*les 4 iphone xcode uitableview iphone-sdk-3.0

我收到了这个警告.

'-respondsToSelector:'在协议中找不到

它出现在下面标有"HERE"的行上.

- (NSString *)tableView:(UITableView *)tableView 
    titleForFooterInSection:(NSInteger)section {

    id<SetsSectionController> sectionController = 
        [sectionControllers objectAtIndex:section];

    if ([sectionController respondsToSelector:
            @selector(tableView:titleForFooterInSection:)]) { //HERE

        return [sectionController tableView:tableView 
            titleForFooterInSection:section];

    }
    return nil;
}
Run Code Online (Sandbox Code Playgroud)

继承我的完整文件.

#import <UIKit/UIKit.h>


@interface SettingsTableViewController : UITableViewController {
    NSArray *sectionControllers;

}

@end
Run Code Online (Sandbox Code Playgroud)

我需要做些什么来修复错误?

zou*_*oul 12

要么SetsSectionController继承自NSObject:

@protocol SetsSectionController <NSObject>
Run Code Online (Sandbox Code Playgroud)

...或演员id:

if ([(id) sectionController respondsTo...])
Run Code Online (Sandbox Code Playgroud)