Skip to content

Commit

Permalink
Bug fix for JPCleaner #721
Browse files Browse the repository at this point in the history
  • Loading branch information
bang590 committed Feb 17, 2017
1 parent cacd2b0 commit 0808169
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Extensions/JPCleaner.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "JPCleaner.h"
#import <objc/runtime.h>
#import <objc/message.h>

@implementation JPCleaner
#pragma clang diagnostic push
Expand Down Expand Up @@ -42,7 +43,13 @@ + (void)cleanClass:(NSString *)className

char *typeDescription = (char *)method_getTypeEncoding(class_getInstanceMethod(cls, @selector(forwardInvocation:)));
IMP forwardInvocationIMP = class_getMethodImplementation(cls, @selector(ORIGforwardInvocation:));
class_replaceMethod(cls, @selector(forwardInvocation:), forwardInvocationIMP, typeDescription);

//forwardInvocationIMP will be _objc_msgForward if ORIGforwardInvocation: doesn't exist
if (forwardInvocationIMP == _objc_msgForward) {
class_replaceMethod(cls, @selector(forwardInvocation:), NULL, typeDescription);
} else {
class_replaceMethod(cls, @selector(forwardInvocation:), forwardInvocationIMP, typeDescription);
}
}
}

Expand Down

0 comments on commit 0808169

Please sign in to comment.