Created
March 16, 2013 13:31
-
-
Save halsk/5176393 to your computer and use it in GitHub Desktop.
NSInvocation を使ってクラスメソッドを呼ぶ ref: http://qiita.com/items/947b1cdaae17e29ce082
This file contains hidden or 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
| // define selector | |
| SEL selector = @selector(postToURL:withParams:async:); | |
| // get method signeture | |
| NSMethodSignature* signature = [[self class] methodSignatureForSelector: selector]; | |
| // make NSInvocation instance | |
| NSInvocation* invocation = [ NSInvocation invocationWithMethodSignature: signature ]; | |
| [invocation setSelector:selector]; | |
| [invocation setTarget:[self class]]; | |
| [invocation setArgument:&strurl atIndex:2]; | |
| [invocation setArgument:¶ms atIndex:3]; | |
| [invocation setArgument:&completionBlock atIndex:4]; | |
| [invocation invoke]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment