play mp3 from network
<p>I have tried below three solutions but none of them worked. I am sure I am missing some key point but not clear what. (FYI, I am trying out below solutions on iPhone device, not on simulator.) </p>

<pre><code>- (IBAction)actionAVPlayer:(id)sender { 
AVPlayer* player = [[AVPlayer alloc] initWithURL:[NSURL URLWithString:urlTextField.text]]; 
[player play];

}

- (IBAction)actionMemoryBuffer1:(id)sender {

  NSError *error;
  NSData *_objectData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlTextField.text]];

  AVAudioPlayer* audioPlayer = [[AVAudioPlayer alloc] initWithData:_objectData error:&amp;error];
  audioPlayer.numberOfLoops = -1;
  audioPlayer.delegate = self;
  audioPlayer.volume = 1.0f;
  [audioPlayer prepareToPlay];

  if (audioPlayer == nil)
    NSLog(@"%@", [error description]);
  else
    [audioPlayer play];
}


- (IBAction)actionMemoryBuffer2:(id)sender {

  NSURLRequest* request = [ NSURLRequest requestWithURL: [NSURL URLWithString:urlTextField.text] ];
  NSError *requestError;
  NSURLResponse *urlResponse = nil;

  NSData *_objectData  = [ NSURLConnection sendSynchronousRequest:request returningResponse: &amp;urlResponse  error: &amp;requestError];

  NSError *error;
  AVAudioPlayer* audioPlayer = [[AVAudioPlayer alloc] initWithData:_objectData error:&amp;error];
  audioPlayer.numberOfLoops = -1;
  audioPlayer.delegate = self;
  audioPlayer.volume = 1.0f;
  [audioPlayer prepareToPlay];

  if (audioPlayer == nil)
    NSLog(@"%@", [error description]);
  else
    [audioPlayer play];
}
</code></pre>

<p>Any help is much appreciated.</p>
