Skip to content

Instantly share code, notes, and snippets.

@zonble
Created May 10, 2009 20:55
Show Gist options
  • Save zonble/109739 to your computer and use it in GitHub Desktop.
Save zonble/109739 to your computer and use it in GitHub Desktop.
Dump a list of methods of an Obj-C Class
#import <Cocoa/Cocoa.h>
#import <objc/objc-runtime.h>
void dumpClass()
{
NSUInteger methodCount = 0;
Method *m = class_copyMethodList([NSObject class], &methodCount);
for (NSInteger i = 0; i < methodCount; i++) {
Method method = m[i];
SEL methodName = method_getName(method);
NSLog(@"method:%@", NSStringFromSelector(methodName));
}
}
int main(int argc, char *argv[])
{
id pool = [[NSAutoreleasePool alloc] init];
dumpClass();
[pool drain];
[pool release];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment