Closed zacwitte closed 10 years ago
master branch has the problem. Please use feat/ClassMethod branch. The branch is under constructed, but is more stable. With the branch, your code is changed to below.
void (^textFieldDidPasteBlock)(id receiver, id sender) = ^(id receiver, id sender)
{
NSLog(@"paste hook receiver: %@, sender: %@", receiver, sender);
RESupermethod(nil, receiver, @selector(paste:), sender);
};
[self.postTextField setBlockForInstanceMethod:@selector(paste:) key:nil block:textFieldDidPasteBlock];
I'm trying to hook into the first responder's paste method, but I still want the normal paste to happen first - then call my code. I was successfully able to add a responder on the paste: selector which calls my block, but then the normal paste doesn't happen. In trying to invoke the supermethod I get an EXC_BAD_ACCESS code: 2 address: 0x1. I'm adding the -fno-objc-arc to the REKit.m and other .m files if that makes any difference.