- (BOOL)transitionToNextPhase {
// 保证代码在主线程
if (![[NSThread currentThread] isMainThread]) {
dispatch_sync(dispatch_get_main_queue(), ^{
[self transitionToNextPhase];
});
return YES;
}
}
- (BOOL)transitionToNextPhase {
// 保证代码在主线程
if (![[NSThread currentThread] isMainThread]) {
dispatch_sync(dispatch_get_main_queue(), ^{
[self transitionToNextPhase];
});
return YES;
}
}
本文标题:保证方法在主线程执行的方法实践
本文链接:https://www.haomeiwen.com/subject/xnfpuxtx.html
网友评论