0
HI由于警报和定时器存在问题,问题是:有关定时器,设备和模拟器的问题
timer1 = [NSTimer scheduledTimerWithTimeInterval:1.0/30 target:self
selector:@selector(Loop1) userInfo:nil repeats:YES];
timer2 = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self
selector:@selector(timrClock) userInfo:nil repeats:YES];
-(void) timrClock
{
long diff = -((long)[self.now timeIntervalSinceNow]);
timrLabel.text = [NSString stringWithFormat:@"%02d:%02d",(diff/60)%60,diff%60];
if(diff >= timeBankCounter)
{
if(clockTimer != nil)
{
[clockTimer invalidate];
clockTimer = nil;
}
targetButton.userInteractionEnabled = NO;
NSLog(@"RESTART");
NSLog(@"chance:- %d",[[self appDelegate].chance intValue]);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Time Out!" message:@"Your time is over." delegate:self cancelButtonTitle:@"Try Again." otherButtonTitles:@"Quit"];
[alert show];
[alert release];
//[timer invalidate];
}
}
一切都会在模拟器罚款,但在设备上的警报不显示和应用terminates.On控制台上面的NSLog(@“的机会后有一个消息“EXC_BAD_ACCESS” --- “)。
哦!我忘了以零结束其他按钮。 Thanx.我从来没有想到这个错误会在这里,因为它是一个愚蠢的错误。 – Jack 2010-09-03 05:29:13