我使用此代码并冻结屏幕。为什么会这样?
__block double delayInSeconds = 1.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
if ([self loginTypeIsUser])
{
[self getVideoPlayLinksForEntity:wallpostEntity];
}
});
答案 0 :(得分:1)
这是因为您正在锁定主线程。你不应该dispatch_get_main_queue()
,而是在后台进行。
尝试:
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0)
或
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)