Objective C for iOS中的属性reflection

我希望能够对Objective C中的类使用reflection来确定运行时可用的属性。

我现在正在使用类似的类

NSString *str = NSStringFromClass([object class]); 

我想要做的是使用这个结果返回到类,看看有什么属性可用以及这些属性是什么types。

可能会有所帮助:

您可以使用class_copyPropertyList获取类中的属性列表

 objc_property_t * class_copyPropertyList(Class cls, unsigned int *outCount) 

然后从每个属性中,可以使用property_getName函数获取属性名称,使用property_getName函数获取属性属性(如果需要过滤读写属性)。