Objective c 程序突然出现了许多错误

Objective c 程序突然出现了许多错误,objective-c,xcode,ios5,avaudiorecorder,Objective C,Xcode,Ios5,Avaudiorecorder,在过去的几个月里,我一直在制定一个计划。我终于到了一切都很顺利的地步。该程序从一开始就为iOS 5构建。我只是检查了几天前检查时,我认为我已经巩固的东西,它们工作得很好。但现在一切都在胡闹。我的录音机坏了。不知道在什么地方。我的探索者的价值观没有改变。无法播放录制的内容。录音机过去需要一秒钟的时间来加载,它会冻结屏幕然后启动,现在是瞬间,我觉得很奇怪。我很抱歉,如果我含糊不清,但我完全被难住了。“录制”按钮可在“录制”命令后启动计时器。计时器中有一个if语句,它有许多子句,其中一个是myReco

在过去的几个月里,我一直在制定一个计划。我终于到了一切都很顺利的地步。该程序从一开始就为iOS 5构建。我只是检查了几天前检查时,我认为我已经巩固的东西,它们工作得很好。但现在一切都在胡闹。我的录音机坏了。不知道在什么地方。我的探索者的价值观没有改变。无法播放录制的内容。录音机过去需要一秒钟的时间来加载,它会冻结屏幕然后启动,现在是瞬间,我觉得很奇怪。我很抱歉,如果我含糊不清,但我完全被难住了。“录制”按钮可在“录制”命令后启动计时器。计时器中有一个if语句,它有许多子句,其中一个是myRecorder.isRecording==NO,而if语句的行为就好像满足了条件并执行了内部代码,尽管在计时器启动之前,记录器就被告知要录制。我很困惑。请帮忙。谢谢

记录按钮代码: -(iAction)记录:(id)发件人{ //[myPlayer play]

if ([sender tag] == 2){
    [self stop];
    [sender setTag:1];
    [sender setTitle:@"Record"];
    [sender setEnabled:NO];
    NSLog(@"Tag is 2");
}else{
    if ([myPlayer isPlaying]){
        [myPlayer pause];
        [myPlayer setCurrentTime:0];
    }
    anotherControl = 0; 
    theToolbar.userInteractionEnabled = NO;
    [theToolbar setTintColor:myColor];
    [theToolbar setAlpha:.5];
    [controlSong setTintColor:[UIColor blackColor]];
    beatPackTable.userInteractionEnabled = NO;
    beatPackTable.hidden = YES;
    onScreenTut.text = @"(Hold phone to your face and begin. When finished recording, hit the stop button)";
    recordCover.titleLabel.text = @"Recording";
    recordCover.titleLabel.textAlignment = UITextAlignmentCenter;
    recordCover.hidden = NO;
    NSString *docsDir;
    myDate = [[NSDate alloc] init];
    myDate = [NSDate date];
    seekerTwo.userInteractionEnabled = NO;
    homeButton.enabled = NO;
    tracksButton.enabled = NO;
    tutButton.enabled = NO;
    previewBeatTwo.enabled = NO;
    previewPauseTwo.enabled = NO;

    /*    
     NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
     [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
     [dateFormatter setDateStyle:NSDateFormatterShortStyle];
     NSString *myDate2 = [NSString stringWithFormat:@"%@",[dateFormatter stringFromDate:myDate]];
     */    
    //    dirPaths = NSSearchPathForDirectoriesInDomains(
    //                                                   NSDocumentDirectory, NSUserDomainMask, YES);
    docsDir = NSTemporaryDirectory();


    NSString *soundFilePath = [docsDir
                               stringByAppendingPathComponent:[NSString stringWithFormat:@"%@%i.caf",myDate,control]];

    NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];

    NSDictionary *recordSettings = [NSDictionary 
                                    dictionaryWithObjectsAndKeys:
                                    [NSNumber numberWithInt:AVAudioQualityLow],
                                    AVEncoderAudioQualityKey,
                                    [NSNumber numberWithInt:16], 
                                    AVEncoderBitRateKey,
                                    [NSNumber numberWithInt: 2], 
                                    AVNumberOfChannelsKey,
                                    [NSNumber numberWithFloat:44100.0], 
                                    AVSampleRateKey,
                                    nil];

    NSError *error = nil;



    myNewRecorder = [[AVAudioRecorder alloc]
                  initWithURL:soundFileURL
                  settings:recordSettings
                  error:&error];

    if (error)
    {
        NSLog(@"error: %@", [error localizedDescription]);

    } else {
        [myNewRecorder prepareToRecord];}




    seeker.userInteractionEnabled = NO;
    voiceVolumeControl.enabled =YES;
    recordButton.enabled = NO;

    stopButton.enabled = YES;


    myPlayer.currentTime = 0;
    [myNewRecorder record];
    [myPlayer play];
    [NSTimer scheduledTimerWithTimeInterval:1.0f
                                     target:self
                                   selector:@selector(updateCounter:)
                                   userInfo:nil
                                    repeats:YES];

if ([sender tag] == 1){
    [sender setTitle:@"End"];
    [sender setTag:2];

}}
NSLog(@"%@",myDate);
}
计时器代码:

-(void)updateCounter:(NSTimer*)计时器{

请参阅我(和其他人)对程序员SE问题的回答:


基本上,找出自突然出现的bug以来发生了什么变化,可能是新发布的iOS 5、Xcode或您的软件使用的外部库。

您可以使用您使用的任何源代码管理系统返回到已知的良好工作版本,然后从中继续工作吗?编码时,您将受益于GIT或Subv等源代码管理系统版本。它可以让您轻松获取代码每个版本的备份,比较差异,以及更多内容。始终,始终使用一个版本,即使您自己编写代码。请参阅我的答案(以及其他)对于程序员的问题SE:有人认为这可能与升级到GM有关吗?我不记得上次测试应用程序的这个区域的确切时间,所以我不知道升级后它是否工作,但升级后有没有遇到任何问题,可能与此有关?-1因为缺少代码格式。
    if ([myNewRecorder isRecording]) {
        [seeker setValue:myPlayer.currentTime/myPlayer.duration animated:YES];}

    if ([myPlayer2 isPlaying])
    {
        [seeker setValue:myPlayer2.currentTime/myPlayer2.duration animated:YES];
    }

    if ([myPlayer isPlaying] && myPlayer2.isPlaying == NO && myNewRecorder.isRecording == NO && isNotepadOpen == NO && anotherControl == 0) {
        [myPlayer stop];
        myPlayer.currentTime = 0;
        [seeker setValue:0];
        playButton.enabled = YES;
        stopButton.enabled = NO;
        NSLog(@"Its the timer for some reason");
    }

    if ([myNewRecorder isRecording] || [myPlayer isPlaying] || [myPlayer2 isPlaying]){
        [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
    }else{
        [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
    }
    if ([myPlayer isPlaying]){
        [seekerTwo setValue:myPlayer.currentTime/myPlayer.duration animated:YES];
    }
}