Conversation
|
The version number should be bumped to v1.4.3 I think. |
|
This looks great! Working on a v2 is on my TODO for a while now, the day-to-day work to manage our PDF SDK PSPDFKit takes a lot of work but we also actively use Aspects there so it's not going anywhere. I'll see that I find time on the weekend for that. Thanks a lot for working on that KVO problem - that's a tough one! |
…orwardInvocation created by RAC&KVO.
…oks`, further more, aspects' forwardInvocation has been skipped while iterating the super class.
|
Hi @doggy id token = [object aspect_hookSelector...] This will crash. How could we keep our aspect-hooded class and clean up the object? |
|
@TozyZuo Yeah, you're right!! Some code for testing the class is needed after trimming aspects' suffix on that class. Thanks for the reporting.. |
Hi, @steipete
I loved aspects, and I really want it can be used by everyone in every projects. But I think the KVO crash is one of limitation which block the way.
So, I have spent many times(and in many ways) to making it works, and hopefully, I got a solution:
original _cmdThat means we need re-swizzle the
originalSelectorwe saved priviously to class-isa and setinvocation.selectorwith it also before calling[invocation invoke];All things works like a charm.
KVO Coexistence with different aspects hook mode:
All tests above added/updated to the testCase target.
I can provide more detail about why this way has been choosen with this PR if you're interested.
One limitation:
Instance Hook after KVO
Doing instance hook on a KVO'ed class will trigger an in-place swizzle, then, the
forwardInvocation:will be applied to the isa-swizzled subclass created by KVO. Aspects will works until the isa-swizzled subclass destoryed once all observer has been removed. As our usual practice, removes all observers indeallocmethod. This is the same logic as RAC and it's acceptable I think.Many thanks for all your work on this project!