当我从我的 secondView 回到我的 mainView 时,我正在我的 secondView 的 viewDidDisappear 方法中处理一些东西。问题是,由于应用程序必须执行的工作,我的 mainView 卡住了。
这是我所做的:
-(void)viewDidDisappear:(BOOL)animated
{
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^{
dbq = [[dbqueries alloc] init];
[[NSNotificationCenter defaultCenter] postNotificationName:@"abc" object:nil];
//the notification should start a progressView, but because the whole view gets stuck, I can't see it working, because it stops as soon as the work is done
dispatch_sync(dispatch_get_main_queue(), ^{
//work
});
});
我究竟做错了什么?提前致谢!