title: AVAudioPlayer initWithData returning nil
body: <p>I have used the following code to initialise an AVAudioPlayer object with NSData, which in turn has the data of an mp3 in my main bundle.</p>
  
  <pre><code>NSError *error;
  NSString *filePathForBgAudio = [[NSBundle mainBundle] pathForResource:@"beebuzz10" ofType:@"mp3"];
  NSData *bgAudioData = [NSData dataWithContentsOfFile:filePathForBgAudio];
  bgAudioPlayer = [[AVAudioPlayer alloc] initWithData:bgAudioData error:&amp;error];
  bgAudioPlayer.delegate = self;
  </code></pre>
  
  <p>I have declared <code>bgAudioPlayer</code> in the <code>.h</code> file. But when I checked by setting breakpoint, I found that after this line <code>bgAudioPlayer = [[AVAudioPlayer alloc] initWithData:bgAudioData error:&amp;error];</code> the <code>bgAudioPlayer</code> is still shown to be <code>nil</code>. But the <code>filePathForBgAudio</code> and <code>bgAudioData</code> are initialised correctly and has data. just the <code>bgAudioPlayer</code> is <code>nil</code>. What is the problem in the above code? How to rectify this?</p>