className and isKindOfClass messages sent to an object
Use:
[element isMemberOfClass: [NSString class]]
Not:
[[element class] isMemberOfClass: [NSString class]]
NSString and NSMutableString are implemented as a class cluster (see "String Objects" in the iOS version of the documentation).
So isKindOfClass: should return true but isMemberOfClass: will return false since NSString isn't the exact type of the object.
NSString
is made up of a cluster of classes. They are also toll-free-bridged with CFString
s (from CoreFoundation
). It's very likely somewhere in the implementation of NSString
this NSCFString
appears (I don't know all the facts, but my deduction here is this class acts as the bridge).