title: AVAudioPlayer and AVAudioRecorder: Delegate Methods not Called
body: <p>My delegate methods <code>audioRecorderDidFinishRecording</code> and <code>audioPlayerDidFinishPlaying</code> are not being called. Those methods should trigger a 'stopanimation` method that stops an animation after recording is finished. </p>
  
  <p>I have placed a call call to the <code>stopanimation</code> method at the end of <code>audioPlayerDidFinishPlaying</code>.</p>
  
  <p>Here is the relevant code where the delegate is assigned:</p>
  
  <pre><code>   VoiceEditor.h
  
      @interface VoiceEditor : UIViewController &lt;UITextFieldDelegate, AVAudioRecorderDelegate, AVAudioPlayerDelegate&gt;{    
  }
  
  VoiceEditor.m
  
  - (void)record{
      recorder = [[AVAudioRecorder alloc] initWithURL:[NSURL fileURLWithPath:pathString] settings:recordSettings error:nil];
      [recorder setDelegate:self];
      [recorder record];
      recording = YES;        
      [pauseButton setImage:[UIImage imageNamed:@"stop.png"] forState:UIControlStateNormal];
      [pauseButton setEnabled:YES];
      [playButton setEnabled:NO];
      [recordButton setEnabled:NO];  
      [self beginAnimation];
  }
  
  - (void)play{              
      player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:pathString] error:nil];
      double seconds=[player duration];
      NSLog(@"%f",seconds);
      [player setDelegate:self];
      [player play];
      playing = YES;              
      [recordButton setEnabled:NO];
      [pauseButton setEnabled:YES];
      [playButton setEnabled:NO];     
      [self beginAnimation];
  }
  </code></pre>