2013-04-10 23:57:08 -07:00
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
2014-04-02 16:56:35 +00:00
|
|
|
@interface Example : NSObject
|
2013-04-10 23:57:08 -07:00
|
|
|
- (NSNumber *)foo;
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation Example
|
|
|
|
|
- (NSNumber *)foo {
|
2014-04-02 16:56:35 +00:00
|
|
|
return @42;
|
2013-04-10 23:57:08 -07:00
|
|
|
}
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
int main (int argc, const char *argv[]) {
|
2014-04-02 16:56:35 +00:00
|
|
|
@autoreleasepool {
|
2013-04-10 23:57:08 -07:00
|
|
|
|
2014-04-02 16:56:35 +00:00
|
|
|
id example = [[Example alloc] init];
|
|
|
|
|
SEL selector = @selector(foo); // or = NSSelectorFromString(@"foo");
|
|
|
|
|
NSLog(@"%@", [example performSelector:selector]);
|
2013-04-10 23:57:08 -07:00
|
|
|
|
2014-04-02 16:56:35 +00:00
|
|
|
}
|
2013-04-10 23:57:08 -07:00
|
|
|
return 0;
|
|
|
|
|
}
|