Reputation: 4617
i am calling a method after checking its existence but it is keep giving the error. i am doing all this stuff many times but now it is giving error. any Help
if ([[self.navDashBoard.viewControllers lastObject] respondsToSelector:@selector(updateScreenForExtraOption)])
{
[[self.navDashBoard.viewControllers lastObject] updateScreenForExtraOption];
}
PLEASE see my updated image same thing works perfectly at the same class and other method does not. I had not make any Category or ViewController subclass that has refreshPage method in it.
Upvotes: 0
Views: 54
Reputation: 2823
usually what you see is this:
if ([[self.navDashBoard.viewControllers lastObject] respondsToSelector:@selector(updateScreenForExtraOption)])
{
[[self.navDashBoard.viewControllers lastObject] performSelector:@selector(updateScreenForExtraOption)];
}
This will give a warning but not a error while calling the method directly will. Or do it the way Paulw11 suggested and cast it to the right type.
Upvotes: 2
Reputation: 4617
i just fixed this issue by importing a class(UIViewController subclass) that has this method declare as public. even i am not using that class.
Upvotes: 0