For iOS, given some NSDictionary key/value pairs where strings values were added as NSString and int/float values were added as NSNumber, is there a way to test the data type of a value to see whether it is NSString or NSNumber?
For iOS, given some NSDictionary key/value pairs where strings values were added as NSString
Share
NSObject offers:
if obj is the value you get out of the NSDictionary then checkout:
If you check for these and you don’t expect anything but NSString or NSNumber in the dictionary, then I would add an NSAssert in the else block.
There’s more comments here on nuances of NSString and NSCFString:
In Objective-C, how do I test the object type?