views:

59

answers:

2

I'm getting this warning.

'-respondsToSelector:' not found in protocol(s)

It occurs on the line marked by "HERE" below.

- (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;
}

Heres my full h files.

#import <UIKit/UIKit.h>


@interface SettingsTableViewController : UITableViewController {
    NSArray *sectionControllers;

}

@end

What do i need to do to fix the error?

+4  A: 

Either make SetsSectionController inherit from NSObject:

@protocol SetsSectionController <NSObject>

...or cast to id:

if ([(id) sectionController respondsTo...])
zoul
A: 
if ([(NSObject *)sectionController respondsToSelector:
        @selector(tableView:titleForFooterInSection:)])
coob