Skip to content

Commit 91f5c14

Browse files
committed
Fix swift class case #123
1 parent 0a5e09c commit 91f5c14

File tree

3 files changed

+6
-45
lines changed

3 files changed

+6
-45
lines changed

JJException.xcodeproj/xcuserdata/jezz.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -55,37 +55,5 @@
5555
landmarkType = "3">
5656
</BreakpointContent>
5757
</BreakpointProxy>
58-
<BreakpointProxy
59-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
60-
<BreakpointContent
61-
uuid = "AE36729D-70AF-4C17-BBCC-4CAE860EDE90"
62-
shouldBeEnabled = "Yes"
63-
ignoreCount = "0"
64-
continueAfterRunningActions = "No"
65-
filePath = "JJException/Source/ARC/NSAttributedString+AttributedStringHook.m"
66-
startingColumnNumber = "9223372036854775807"
67-
endingColumnNumber = "9223372036854775807"
68-
startingLineNumber = "68"
69-
endingLineNumber = "68"
70-
landmarkName = "-hookEnumerateAttributesInRange:options:usingBlock:"
71-
landmarkType = "7">
72-
</BreakpointContent>
73-
</BreakpointProxy>
74-
<BreakpointProxy
75-
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
76-
<BreakpointContent
77-
uuid = "1EFAC455-3A03-4E4B-85CD-EDE56984EFD2"
78-
shouldBeEnabled = "Yes"
79-
ignoreCount = "0"
80-
continueAfterRunningActions = "No"
81-
filePath = "JJException/Source/ARC/NSAttributedString+AttributedStringHook.m"
82-
startingColumnNumber = "9223372036854775807"
83-
endingColumnNumber = "9223372036854775807"
84-
startingLineNumber = "64"
85-
endingLineNumber = "64"
86-
landmarkName = "-hookEnumerateAttributesInRange:options:usingBlock:"
87-
landmarkType = "7">
88-
</BreakpointContent>
89-
</BreakpointProxy>
9058
</Breakpoints>
9159
</Bucket>

JJException/Source/ARC/NSTimer+CleanTimer.m

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
// Copyright © 2018年 Jezz. All rights reserved.
77
//
88

9+
#import <objc/runtime.h>
10+
#import <objc/message.h>
11+
912
#import "NSTimer+CleanTimer.h"
1013
#import "NSObject+SwizzleHook.h"
1114
#import "JJExceptionProxy.h"
@@ -54,19 +57,9 @@ - (void)fireTimer{
5457
return;
5558
}
5659
if ([self.target respondsToSelector:self.selector]) {
57-
// Fix performSelector maybe some memmory leak or return object crash
58-
NSMethodSignature* signature = [self.target methodSignatureForSelector:self.selector];
59-
if (!signature) {
60-
return;
61-
}
62-
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:signature];
63-
invocation.target = self.target;
64-
invocation.selector = self.selector;
65-
if (signature.numberOfArguments > 2) {
66-
[invocation setArgument:&_timer atIndex:2];
67-
}
68-
[invocation retainArguments];
69-
[invocation invoke];
60+
// Fix swift case, the parent class is SwiftObject, did not invoke the methodSignatureForSelector method
61+
// https://github.com/jezzmemo/JJException/issues/123
62+
((void(*)(id, SEL, NSTimer*))objc_msgSend)(self.target, self.selector, _timer);
7063
}
7164
}
7265

0 commit comments

Comments
 (0)