How to tell if a Class inherits from NSObject (Objective-C)

前端 未结 4 1027
小鲜肉
小鲜肉 2021-01-06 12:29

I\'m working in Objective-C on the iPhone and need to know whether a \'Class\' inherits from \'NSObject\'.

I tried checking if it responds to an NSObject selector:

4条回答
  •  春和景丽
    2021-01-06 12:53

    The class 'Class' does not inherit from NSObject. That means methods defined by NSObject (such as isKindOfClass or respondsToSelector) cannot be used on it.

    What are you trying to do with it in the first place?

提交回复
热议问题