Aspects icon indicating copy to clipboard operation
Aspects copied to clipboard

Unrecognized selector sent to instance - Debugging

Open avnerbarr opened this issue 8 years ago • 0 comments

Following up on the previous issue:

I added a stub implementation to the view controller in question that was crashing

Now I can see that the crash is stemming from :

// Instead hooks.
    BOOL respondsToAlias = YES;
    if (objectContainer.insteadAspects.count || classContainer.insteadAspects.count) {
        aspect_invoke(classContainer.insteadAspects, info);
        aspect_invoke(objectContainer.insteadAspects, info);
    }else {
        Class klass = object_getClass(invocation.target);
        do {

            respondsToAlias = [klass instancesRespondToSelector:aliasSelector]; // HERE 
            if (respondsToAlias) {  //was (respondsToAlias = [klass instancesRespondToSelector:aliasSelector])
                [invocation invoke];
                break;
            }
        }while (!respondsToAlias && (klass = class_getSuperclass(klass)));
    }

Removing the empty implementation from the view controller causes a crash with no clear backtrace.

avnerbarr avatar Dec 13 '15 19:12 avnerbarr