No method found compiler warning

Posted by Magic Bullet Dave on Stack Overflow See other posts from Stack Overflow or by Magic Bullet Dave
Published on 2010-05-24T09:15:51Z Indexed on 2010/05/24 9:21 UTC
Read the original article Hit count: 346

I have create a class from a string, check it is valid and then check if it responds to a particular method. If it does then I call the method. It all works fine, except I get an annoying compiler warning: "warning: no '-setCurrentID:' method found". Am I doing something wrong here? Is there anyway to tell the compiler all is ok and stop it reporting a warning?

The here is the code:

// Create an instance of the class
id viewController = [[NSClassFromString(class) alloc] init];

// Check the class supports the methods to set the row and section
if ([viewController respondsToSelector:@selector(setCurrentID:)]) 
    {
        [viewController setCurrentID:itemID];
    }   

// Push the view controller onto the tab bar stack      
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];

Cheers

Dave

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone-sdk