Jim Kubicek


When isKindOfClass Is Not Kind of Class?

I’ve been running into an issue over the past few days where [objA isKindOfClass:[ClassA class]] is returning false when clearly objA is a kind of ClassA. I’m running these tests using SenTesting kit and I’m not compiling the .m files in my test target, which is the only issue that StackOverflow suggests.

I am including my Storyboards in my testing target. Perhaps that’s the problem? Let me just remove those Storyboards from the testing target…

BOOM. That was it.

Also, for future reference, in case anyone finds their way here while looking for how to load storyboards in a SenTestingKit test target, here’s how:

NSBundle *mainBundle = [NSBundle bundleForClass:[self class]];
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:name bundle:mainBundle];
viewController = [storyBoard instantiateViewControllerWithIdentifier:MainViewController];