Skip to content

Commit

Permalink
Fix swift class case #123
Browse files Browse the repository at this point in the history
  • Loading branch information
jezzmemo committed Apr 21, 2022
1 parent 0a5e09c commit 91f5c14
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 45 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,5 @@
landmarkType = "3">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "AE36729D-70AF-4C17-BBCC-4CAE860EDE90"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "JJException/Source/ARC/NSAttributedString+AttributedStringHook.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "68"
endingLineNumber = "68"
landmarkName = "-hookEnumerateAttributesInRange:options:usingBlock:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "1EFAC455-3A03-4E4B-85CD-EDE56984EFD2"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "JJException/Source/ARC/NSAttributedString+AttributedStringHook.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "64"
endingLineNumber = "64"
landmarkName = "-hookEnumerateAttributesInRange:options:usingBlock:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
19 changes: 6 additions & 13 deletions JJException/Source/ARC/NSTimer+CleanTimer.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// Copyright © 2018年 Jezz. All rights reserved.
//

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

#import "NSTimer+CleanTimer.h"
#import "NSObject+SwizzleHook.h"
#import "JJExceptionProxy.h"
Expand Down Expand Up @@ -54,19 +57,9 @@ - (void)fireTimer{
return;
}
if ([self.target respondsToSelector:self.selector]) {
// Fix performSelector maybe some memmory leak or return object crash
NSMethodSignature* signature = [self.target methodSignatureForSelector:self.selector];
if (!signature) {
return;
}
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:signature];
invocation.target = self.target;
invocation.selector = self.selector;
if (signature.numberOfArguments > 2) {
[invocation setArgument:&_timer atIndex:2];
}
[invocation retainArguments];
[invocation invoke];
// Fix swift case, the parent class is SwiftObject, did not invoke the methodSignatureForSelector method
// https://github.com/jezzmemo/JJException/issues/123
((void(*)(id, SEL, NSTimer*))objc_msgSend)(self.target, self.selector, _timer);
}
}

Expand Down

0 comments on commit 91f5c14

Please sign in to comment.