title: audioPlayerDidFinishPlaying not called
body: <p>I am having a problem with the AVAudioPlayer. I want to do something after my soundfile finished. The sound is playing, but the audioPlayerDidFinishPlaying is not called. </p>
  
  <p>my .h</p>
  
  <pre><code>#import "ViewController.h"
  #import &lt;AVFoundation/AVFoundation.h&gt;
  
  @interface Tag1Uebung1ViewController : ViewController {
      AVAudioPlayer *audioPlayer;
  }
  
  @end
  </code></pre>
  
  <p>my .m (impl. file)</p>
  
  <pre><code>#import "Tag1Uebung1ViewController.h"
  #import &lt;AVFoundation/AVFoundation.h&gt;
  #import "Tag1U2ViewController.h"
  
  @interface Tag1Uebung1ViewController ()
  @end
  @implementation Tag1Uebung1ViewController
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  {
      self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
      if (self) {
          // Custom initialization
      }
      return self;
  }
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
  
      NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/crunch_wdh8.mp3", [[NSBundle mainBundle] resourcePath]]];
  
      NSError *error;
      audioPlayer.delegate = self;
  
      NSLog(@"Entered the callback function");
  
      audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&amp;error];
      //audioPlayer.numberOfLoops = 0;
  
      if (audioPlayer== nil) {
          NSLog([error description]);
      } else {
          [audioPlayer play];    }
  }
  
  
  
  - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
  {
      NSLog(@"audioPlayerDidFinishPlaying");
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  
  @end
  </code></pre>
  
  <p>My debug console only gives me "Entered the callback function", so i mean that the viewDidLoad function is called correctly. What I am doing wrong?</p>