isKindOfClass isMemeberOfClass 的区分

isKindOfClass: returns YES if the receiver is an instance of the specified class or an instance of any class that inherits from the specified class.

isMemberOfClass: returns YES if the receiver is an instance of the specified class.

但是这样尽量少使用吧, ruby说duck typing.比较少依赖类型。

其实我多数是为了识别一个对象是否是mutable,因为给一个不是mutable的对象设置值会引发异常。NSMutableDictionary, NSDictionary,这两个通过上面两个方法,没有成功识别出来。所以在传参数的时候就要确保类一定要传对对象。

原文地址:https://www.cnblogs.com/studyNT/p/4499989.html