NSTimer Crashing



感谢您的帮助。实验基本进度指示器动画。这崩溃了,并指出:";TO8生成器是用优化编译的——步进可能会表现得很奇怪;变量可能不可用"TO8 Generator显然就是应用程序。

消息:";选择器"scheduledTimerWithTimeInterval:选择器:userInfo:重复:"没有已知的类方法

有什么见解吗?再次感谢。

NSTimer *timer;
int count;  
if(!timer)
{
timer = [NSTimer scheduledTimerWithTimeInterval:0.01
target:self
selector:@selector(checkThem:)
userInfo:nil
repeats:YES];
[progressBar startAnimation: self];
}
-(void)checkThem:(NSTimer *)aTimer
{
count++;
if(count > 100)
{
count = 0;
[timer invalidate];

timer = NULL;
[progressBar setDoubleValue:0.0];
[progressBar stopAnimation: self];
}
else
{
[progressBar setDoubleValue:(100.0 * count) / 100];
}
}
Andy的评论提示我检查Scheme配置"DeBug可执行文件";已启用。因此,该函数在编译后将无法工作。然后我禁用了该选项。这么做之后一切都很好。很抱歉给你带来麻烦。

最新更新