0

我正在尝试在使用 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 并在函数中休眠时,它可以工作。

4

0 回答 0