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

下拉刷新偶现不能返回到顶部 #1546

Closed
kedu opened this issue Sep 27, 2021 · 2 comments
Closed

下拉刷新偶现不能返回到顶部 #1546

kedu opened this issue Sep 27, 2021 · 2 comments

Comments

@kedu
Copy link

kedu commented Sep 27, 2021

描述bug
下拉刷新偶现不能返回到顶部

必现/偶发?
偶现

我的诉求是我替换了MJRefreshDispatchAsyncOnMainQueue会不会出现问题。因为这个解决了问题。
具体看我下面贴的代码
// 异步主线程执行,不强持有Self
//#define MJRefreshDispatchAsyncOnMainQueue(x)
//__weak typeof(self) weakSelf = self;
//dispatch_async(dispatch_get_main_queue(), ^{
//typeof(weakSelf) self = weakSelf;
//{x}
//});
#define MJRefreshDispatchAsyncOnMainQueue(x)
__weak typeof(self) weakSelf = self;
if ([NSThread isMainThread]) {
typeof(weakSelf) self = weakSelf;
{x}
} else {
dispatch_async(dispatch_get_main_queue(), ^{
typeof(weakSelf) self = weakSelf;
{x}
});
}

希望能快点回答一下我,我这个项目就要上线了。

@kedu kedu added the bug label Sep 27, 2021
@wolfcon
Copy link
Collaborator

wolfcon commented Sep 28, 2021

这里加 Async 并不是为了是不是主线程的问题. 而是为了延迟一小段时间再执行代码
你的这段代码功能与原来的没什么区别.
可能是这个原因 #1329

@kedu
Copy link
Author

kedu commented Sep 28, 2021

谢谢你的回答。不会引起系统性问题的话,那我就先这样做。因为我感觉#1329的方案都差不多,而且延迟一小段时间再执行代码这个是时间是系统控制的,所以我这样就是时间特别快的情况。

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

No branches or pull requests

2 participants