Determine whether the specified class is equal to a certain class
//method one
[numberObject isKindOfClass:NSClassFromString(@"__NSCFBoolean")];
//Method Two
NSNumber *booleanNumber = @YES;
const char *typeEncoding = [booleanNumber objCType];
NSString *typeString = [NSString stringWithUTF8String:typeEncoding];
//Method 3
[isDebugMode isEqual:[NSNumber numberWithBool:YES]] ? YES : NO;
Determine by type-encoded string
The __NSCFBoolean type is a private subclass of NSNumber. There is no way to obtain the type encoding string directly through @encode(BOOL).
Solution: @YES means it is the __NSCFBoolean type in the NSNumber type
isDebugMode.objCType == @YES.objCType
objcType is a unique method of NSNumber to obtain type-encoded strings.
For reference logic, see isPropertyValueTypeBOOL
The encoded string of NSNumber type currently obtained is i and __NSCFBoolean is c (but I think the macro definition should only be in arm64) @encode(BOOL) is B
[propertyValue objCType] Gets the type encoding string of object propertyValue but objCType is only available in NSNumber