我在我的objective-c项目中实现了MBProgressHUD,而progressHUD启动我的应用程序崩溃。这是我的日志
0 CoreFoundation 0x0000000102b35f45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000101b08deb objc_exception_throw + 48
2 CoreFoundation 0x0000000102b3e56d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x0000000102a8beea ___forwarding___ + 970
4 CoreFoundation 0x0000000102a8ba98 _CF_forwarding_prep_0 + 120
5 EyeQueExam 0x0000000100e80762 -[MBProgressHUD launchExecution] + 82
6 Foundation 0x0000000101792eab __NSThread__start__ + 1198
7 libsystem_pthread.dylib 0x000000010568e05a _pthread_body + 131
8 libsystem_pthread.dylib 0x000000010568dfd7 _pthread_body + 0
9 libsystem_pthread.dylib 0x000000010568b3ed thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
此代码行也会收到信号SIGABRT错误:
[targetForExecution performSelector:methodForExecution withObject:objectForExecution];
编辑:
// MBProgressHUD
HUD = [[MBProgressHUD alloc] initWithView:self.view];
HUD.labelText = @"Uploading to Cloud...";
HUD.detailsLabelText = @"Just relax";
HUD.mode = MBProgressHUDModeAnnularDeterminate;
[self.view addSubview:HUD];
[HUD show:YES];
[HUD showWhileExecuting:@selector(load) onTarget:self withObject:nil animated:YES];
-(NSArray*) load: (NSString *) componentName
{
float progress = 0.0;
while (progress < 1.0) {
progress += 0.01;
HUD.progress = progress;
usleep(50000);
}
}
答案 0 :(得分:0)
尝试编辑此代码:
[HUD showWhileExecuting:@selector(load) onTarget:self withObject:nil animated:YES];
要:
[HUD showWhileExecuting:@selector(load:) onTarget:self withObject:nil animated:YES];
答案 1 :(得分:0)
在load
(void)
方法
- (void) load {
}
您的代码:
- (void) load {
{
float progress = 0.0;
while (progress < 1.0) {
progress += 0.01;
HUD.progress = progress;
usleep(50000);
}
}