isKindOfClass and NSStringFromClass disagree about UIApplicationDelegate

前端 未结 2 1475
灰色年华
灰色年华 2020-12-15 08:25

I was playing with a simple OCUnit test for an iPhone app, and just wanted to assert that the app delegate was an instance of the class that I expected it to be. I didn\'t

2条回答
  •  遥遥无期
    2020-12-15 08:57

    try log out whats the return value of the operation

    NSLog(@"is it kind? %i", [appDelegate isKindOfClass:[CalculatorAppDelegate class]]);
    

    and you can even test if its a member:

    NSLog(@"is it member? %i", [appDelegate isMemberOfClass:[CalculatorAppDelegate class]]);
    

    not sure if it will help but its a starting point

提交回复
热议问题