我已经在目标-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);
}
}发布于 2015-12-22 00:12:46
请尝试编辑以下代码:
[HUD showWhileExecuting:@selector(load) onTarget:self withObject:nil animated:YES];至:
[HUD showWhileExecuting:@selector(load:) onTarget:self withObject:nil animated:YES];发布于 2015-12-22 00:42:31
load变换法在(void)中的应用
- (void) load {
}你的代码:
- (void) load {
{
float progress = 0.0;
while (progress < 1.0) {
progress += 0.01;
HUD.progress = progress;
usleep(50000);
}
}https://stackoverflow.com/questions/34406399
复制相似问题