I needs to list variables for NSManagedObject, I know there is a way to do it using "class_copyIvarList" as given in How do I list all fields of an object in Objective-C?
but "class_copyIvarList" isn't working on "NSManagedObject".
here is piece of code Im using, which is working perfectly fine for "NSObject" but not for "NSManagedObject":
unsigned int outCount;
Ivar *vars = class_copyIvarList([self class], &outCount);
for (int i = 0; i < outCount; i++) {
Ivar var = vars[i];
unsigned int idCount;
NSLog(@"%s %s", ivar_getName(var), ivar_getTypeEncoding(var));
}
free(vars);
What is wrong with it?