Aspects icon indicating copy to clipboard operation
Aspects copied to clipboard

Written methods and function blocks not called

Open Morkrom opened this issue 11 years ago • 1 comments

"aspect_hook" blocks are not being called for me for methods (or dynamic swift functions). If I use a comparable implementation such as this, it works for public methods as expected.

It seems the issue lies partly in the aspect_isCompatibleBlockSignature function... if the method being intercepted is a dynamic swift function, there is a mismatch around line 210 in .m:

if (signaturesMatch) { For loop, the condition for signaturesMatch = NO is not compatible with a dynamic Swift function. }

commenting out this loop allows a dynamic Swift function to work correctly.

If it is an objective-C method, the mismatch occurs due to the blockSignature's numberOfArguments being larger than the methodSignature.

I am still trying to figure out what all this means, and if I do I will attempt a solution. Otherwise some help would be great because I really want to use it.

Morkrom avatar Feb 11 '15 22:02 Morkrom

I have the same question. I aspect tableView:didSelectRowAtIndexPath:

[self aspect_hookSelector:@selector(tableView:didSelectRowAtIndexPath:) withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo> info, UITableView *tableView, NSIndexPath *indexPath) {.....

when code run into invokeWithInfo, it happens "blockSignature's numberOfArguments being larger than the methodSignature."

igiu1988 avatar Aug 15 '18 02:08 igiu1988