steipete / Aspects

Delightful, simple library for aspect oriented programming in Objective-C and Swift.

Home Page:https://twitter.com/steipete

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aspect_deregisterTrackedSelector

hejunm opened this issue · comments

In aspect_deregisterTrackedSelector(id self, SEL selector){} method,
after perform the code below,

if (tracker.selectorNames.count == 0 && tracker.selectorNamesToSubclassTrackers) {
     [swizzledClassesDict removeObjectForKey:currentClass];
 }

aspect can't promise " A method can only be hooked once per class hierarchy."
I think the code should be:

 if (tracker.selectorNames.count == 0 && tracker.selectorNamesToSubclassTrackers.count == 0) {
    [swizzledClassesDict removeObjectForKey:currentClass];
 }