我正在尝试在我正在使用MBProgressHUD的线程中做一些工作。当我尝试执行以下代码时,它会崩溃。
if ([database databaseNeedsMigration]) {
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD.labelText = @"Upgrading Data";
HUD.detailsLabelText = @"Just relax";
HUD.mode = MBProgressHUDModeAnnularDeterminate;
[self.view addSubview:HUD];
HUD.taskInProgress = YES;
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
[HUD showAnimated:YES whileExecutingBlock:^{
[database migrateDatabase];
} onQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0) completionBlock:^{
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
}];
}
然而,当我尝试将一个选择器添加到MBProgressHUD并在其运行的函数中进行休眠时。