Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void class_printIvars(Class cl) {
- unsigned int ivarCount;
- Ivar *ivars = class_copyIvarList(cl, &ivarCount);
- printf("Ivars for %s: \n", class_getName(cl));
- for (int i = 0; i < ivarCount; i++) {
- Ivar ivar = ivars[i];
- printf("%s : %s \n",
- ivar_getName(ivar),
- ivar_getTypeEncoding(ivar));
- }
- free(ivars);
- }
- int main(int argc, const char * argv[]) {
- @autoreleasepool {
- Class bundle = objc_getClass("NSBundle");
- class_printIvars(bundle);
- }
- }
Add Comment
Please, Sign In to add comment