你会认为这会返回一个 NSString:
NSString *class = NSStringFromClass([[_array objectAtIndex:([_array count] -2)] class]);
NSLog(@"Is a kind of NSString: %@", ([[_class classForCoder] isSubclassOfClass:[NSString class]])? @"Yes" : @"No");
if ([class isEqualToString:@"MapViewController"]) {
[_appDelegate.navController0 pushViewController:_userListController animated:YES];
} else {
[_appDelegate.navController3 pushViewController:_userListController animated:YES];
}
但由于某种原因它没有,导致这次崩溃:
Is a kind of NSString: No
-[NSKeyValueObservationInfo isEqualToString:]: unrecognized selector sent to instance 0x6e69080
即使我尝试这个:
NSString *class = (NSString *)[[_array objectAtIndex:([_array count] -2)] class];
它仍然没有返回 NSString,导致了这个崩溃:
Is a kind of NSString: No
+[MapViewController isEqualToString:]: unrecognized selector sent to class 0xd4460
我知道进去,最后一个例子有点牵强,但我很不知道为什么我没有从任何一个返回 NSString ?