HI Frends there is a problem regarding alert and timer. The problem is:
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];
}
}
everything is going fine on simulator but on device the alert doesn't show and app terminates.On console there is a msg "EXC_BAD_ACCESS" after the above NSLog(@"chance---").