我在我的应用程序中使用MBProgressHUD。我总是通过崩溃记者系统收到关于它的崩溃日志,就像那样
Cloudoc-Patient -[MBProgressHUD done] (MBProgressHUD.m:376)
1devices
App Version: -
Thread 0 Crashed:
0 libobjc.A.dylib 0x197350000 + 113616
1 Cloudoc-Patient -[MBProgressHUD done] (MBProgressHUD.m:376)
2 UIKit 0x18a0f0000 + 295108
3 UIKit 0x18a0f0000 + 294860
4 QuartzCore 0x189a2c000 + 87596
5 libdispatch.dylib 0x1979d4000 + 6484
6 libdispatch.dylib 0x1979d4000 + 25100
7 CoreFoundation 0x18555c000 + 914756
8 CoreFoundation 0x18555c000 + 906732
9 CoreFoundation 0x18555c000 + 36724
10 GraphicsServices 0x18efb4000 + 46844
11 UIKit 0x18a0f0000 + 486804
12 Cloudoc-Patient main (main.m:23)
13 libdyld.dylib 0x197a00000 + 10760
在Xcode - > Organizer - >崩溃后,找到代码后,就像crash code一样 我在UIViewController类别
中使用它- (void)showLoadingHUD {
if(!self.view)
{
return;
}
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.removeFromSuperViewOnHide = YES;
hud.mode = MBProgressHUDModeIndeterminate;
}
- (void)hideHUD {
if(!self.view)
{
return;
}
[MBProgressHUD hideAllHUDsForView:self.view animated:NO];
}
任何人都可以帮助我吗?
答案 0 :(得分:0)
我的使用方式:
@property (strong, nonatomic) MBProgressHUD *hud;
然后
#pragma mark - DataManager -
- (void)getData {
if (![self.hud isHidden]) {
[self.hud hideAnimated:YES];
}
self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
[XXXDataManager xxxWithRequestModel:self.xxxRequestModel completion:^(BOOL success, id _Nullable result, NSError * _Nullable error) {
[self.hud hideAnimated:YES];
if (success) {
...
}
else {
...
}
}];}