I have an object that got parsed into an NSString and when I trace out the class name, it says NCDecimalNumber. Why? (I understand NSString is a cluster, but still don’t understand why NSDecimalNumber would be a part of what’s behind the cluster)
The following post asks a similar question but no one answers the why.
Converting NSDecimalNumber to NSString
This sounds like the decoder decodes the number into an
NSDecimalNumber(and strings intoNSStrings).Remember, Objective-C is C, so you can effectively assign anything to a pointer, it is up to you to ensure that the types correspond. This is why you can assign an object of type
NSNumberto a pointer declared to be of typeNSString*. As you can see, class clusters don’t have anything to do with this.So before assigning your object to a variable, you should check the class or, alternatively, just assign the object to a pointer of type
id(which can hold any object).If you need to work on the objects based on their type, you can do something like this: