Created
May 10, 2009 20:55
-
-
Save zonble/109739 to your computer and use it in GitHub Desktop.
Dump a list of methods of an Obj-C Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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