Skip to content

Instantly share code, notes, and snippets.

@halsk
Created March 16, 2013 13:31
Show Gist options
  • Select an option

  • Save halsk/5176393 to your computer and use it in GitHub Desktop.

Select an option

Save halsk/5176393 to your computer and use it in GitHub Desktop.
NSInvocation を使ってクラスメソッドを呼ぶ ref: http://qiita.com/items/947b1cdaae17e29ce082
// 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:&params 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