我使用GCD计时器来计算时间。
_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
dispatch_source_set_timer(_timer, DISPATCH_TIME_NOW, 2.0 * NSEC_PER_SEC, 0);
WEAKSELF
dispatch_source_set_event_handler(_timer, ^{
[weakSelf hideView];
if (![APP_WINDOW.subviews containsObject:self]) {
dispatch_source_cancel(_timer);
}
});
dispatch_source_set_cancel_handler(_timer, ^{
NSLog(@"dispatch_source_t canceled");
});
dispatch_resume(_timer);
如您所见,时间间隔为2秒。 但是当我执行这段代码时,事件处理程序将立即执行。这意味着时间间隔的设置不起作用。
所以问题是为什么时间不符合要求?
答案 0 :(得分:0)
首先确保您的GCD计时器正常工作
然后确定GCD处理代码
This domain is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.