1 强引用 timer
- fix: 未调用invalidate 且 置为 nil
2 页面退出时 perform after 仍未执行
- eg: [self performSelector:@selector(sel) withObject:nil afterDelay:30];
- fix: [NSObject cancelPreviousPerformRequestsWithTarget:self];
3 页面退出时 dispatch after 仍未执行
- eg: dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 50), dispatch_get_main_queue(), ^{})
- fix: __weak typeof(self) weakSelf = self;
__weak typeof(self) weakSelf = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
__strong typeof(self) self = weakSelf;
// [self actionTimer:100];
});
网友评论