title: Xcode stops on prepareToPlay
body: <p>Using AVAudioPlayer to add sound to a working application, it stops / hangs on prepareToPlay.  Note it also stops / hangs on play.  Hitting "Continue program execution" several times makes the application resume.  This problem only occurs when running the program in the simulator.</p>
  
  <p>Using Xcode 4.6</p>
  
  <p>Code Snippets:</p>
  
  <p>ViewController.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import &lt;AVFoundation/AVFoundation.h&gt;
  
  @interface ViewController : UIViewController &lt;AVAudioPlayerDelegate&gt;
  
  @end
  </code></pre>
  
  <p>ViewController.m</p>
  
  <pre><code>#import "ViewController.h"
  
  @interface ViewController ()
  {
  }
  
  @property (nonatomic, strong) AVAudioPlayer *audioPlayer;
  
  @end
  
  @implementation ViewController
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      [self initilizeAudio];
  }
  
  - (void)initilizeAudio
  {
      NSError *error = nil;
      NSURL *audioURL = [[NSBundle mainBundle] URLForResource:@"Background" withExtension:@"mp3"];
  
      self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:audioURL error:&amp;error];
      if (error)
      {
          NSLog(@"Error in audioPlayer: %@", [error localizedDescription]);
      }
      else
      {
          [self.audioPlayer setDelegate:self];
          [self.audioPlayer prepareToPlay];
      }
  }
  
  @end
  </code></pre>
  
  <p>Stack trace</p>
  
  <pre><code>0 __cxa_throw
  21 -[AVAudioPlayer prepareToPlay]
  22 -[ViewController viewDidLoad]
  .
  .
  .
  </code></pre>