//定时检查用户的各种消息未读数(每隔5秒钟)
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(checkUnreadCount) userInfo:nil repeats:YES];
//放到子线程
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];iOS使用定时器,并添加到子线程运行
最新推荐文章于 2022-11-13 18:38:48 发布
本文介绍了一种使用 NSTimer 在 macOS 应用中定时检查用户未读消息计数的方法,并将其添加到子线程运行,以避免阻塞主线程。
1057

被折叠的 条评论
为什么被折叠?



