Skip to content

Instantly share code, notes, and snippets.

@smirn0v
Created April 30, 2013 20:38
Show Gist options
  • Save smirn0v/5491758 to your computer and use it in GitHub Desktop.
Save smirn0v/5491758 to your computer and use it in GitHub Desktop.
alternative nil receiver
#include <Foundation/Foundation.h>
extern id _objc_setNilReceiver(id newNilReceiver);
@interface Foo:NSObject{}
@end
@implementation Foo
- (void) some {
NSLog(@"Some");
}
@end
int main() {
@autoreleasepool {
Foo* test = [Foo new];
_objc_setNilReceiver(test);
[(id)nil some];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment