Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

程序启动crash, fireTimer #134

Open
malgee012 opened this issue Jan 5, 2023 · 3 comments
Open

程序启动crash, fireTimer #134

malgee012 opened this issue Jan 5, 2023 · 3 comments

Comments

@malgee012
Copy link

malgee012 commented Jan 5, 2023

报错文件 NSTimer+CleanTimer.m

image

错误定位代码
- (void)fireTimer{
    if (!self.target) {
        [self.timer invalidate];
        self.timer = nil;
        handleCrashException(JJExceptionGuardNSTimer,[NSString stringWithFormat:@"Need invalidate timer from target:%@ method:%@",self.targetClassName,self.targetMethodName]);
        return;
    }
    if ([self.target respondsToSelector:self.selector]) {
        // 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);
    }
}
  • 调用堆栈

image

@malgee012
Copy link
Author

image

@sharehoney
Copy link

我也遇到了这种情况。
在 NSTimer+CleanTimer.m中 把 @Property(nonatomic,readwrite,【weak】)id target 改成 @Property(nonatomic,readwrite,【strong】)id target 可以避免,但是不确定是否会造成循环引用。

@malgee012
Copy link
Author

我也遇到了这种情况。
在 NSTimer+CleanTimer.m中 把 @Property(nonatomic,readwrite,【weak】)id target 改成 @Property(nonatomic,readwrite,【strong】)id target 可以避免,但是不确定是否会造成循环引用。

我当时也是这么改的, 目前没报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants