在点击倒带两次时,应用程序因为在iPhone设备上测试应用程序[__NSDate timeIntervalSinceNow]: message sent to deallocated instance
-(void)pauseTimer{
pauseStart = [[NSDate dateWithTimeIntervalSinceNow:0] retain];
previousFireDate = [[timer fireDate] retain];
[timer setFireDate:[NSDate distantFuture]];
}
-(void)dealloc
{
[audioPlayer release];
[pauseStart release];
[previousFireDate release];
[super dealloc];
}
-(void)playpauseAction:(id)sender {
if([audioPlayer isPlaying])
{
[sender setImage:[UIImage imageNamed:@"Play Icon.png"] forState:UIControlStateSelected];
[audioPlayer pause];
[self pauseTimer];
[self pauseLayer:self.view.layer];
}else{
[sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal];
[audioPlayer play];
[self resumeTimer];
[self resumeLayer:self.view.layer];
if(isFirstTime == YES)
{
self.timer = [NSTimer scheduledTimerWithTimeInterval:11.0
target:self
selector:@selector(displayviewsAction:)
userInfo:nil
repeats:NO];
isFirstTime = NO;
}
}
}
-(void)rewind:(id)sender{
[timer invalidate];
audioPlayer.currentTime = 0;
MainViewController *viewController = [[[MainViewController alloc] init]autorelease];
viewController.view.frame = CGRectMake(0, 0, 320, 480);
[self.view addSubview:viewController.view];
[self.view addSubview:toolbar];
[self playpauseAction:_playButton];
}
再次点击倒带按钮时,故意在iphone设备应用程序崩溃时测试应用程序并发出消息 [__ NSDate timeIntervalSinceNow]:消息发送到解除分配的实例
任何想法都有问题。
感谢帮助。
感谢。
答案 0 :(得分:0)
删除
[pauseStart release];
[previousFireDate release];
来自dealloc方法的。
这解决了我的问题。