title: Passing data to my custom NSObject?
body: <p>I have attempted to create my first custom class "AudioPlayer". I want to pass data (the audio title) from a tableview to my "AudioPlayer" and load the AudioPlayer with  <strong>initWithContentsOfURL:[NSURL fileURLWithPath:path]</strong> but when I alloc the "AudioPlayer" in my "MainViewController" i get the error "Incompatible pointer types initializing 'Audio  Player*___strong' with and expression of type AVAudioPLayer*". My question is, How would i initialize my custom audio player with the selected audio's title as the URL? It works fine when I created a variable of AVAudioPlayer, but I don't know how to pass it to my custom class.</p>
  
  <p>Here is my custom class Header..</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import &lt;AVFoundation/AVFoundation.h&gt;
  #import &lt;AudioToolbox/AudioToolbox.h&gt;
  
  @interface AudioPlayer : NSObject{
  
      AVAudioPlayer *audioPlayer;
  
      //Volume slider
      NSTimer *volumeTimer;
      IBOutlet UISlider *volumeSlider;
  }
  
  -(bool) isPlaying;
  -(bool) isPaused;
  
  -(void)playPause:(id)sender;
  
  @property (nonatomic, retain) AVAudioPlayer *audioPlayer;
  
  @end
  </code></pre>
  
  <p>Here is my custom class implementation file...</p>
  
  <pre><code>#import "AudioPlayer.h"
  
  @implementation AudioPlayer
  
  @synthesize audioPlayer;
  
  -(void)playPause{
  
      if ([audioPlayer isPlaying]) {
  
          [audioPlayer pause];
  
      } else { 
  
          [audioPlayer play];
  
      }
  }
  
  -(void)volumeSlider
  {
      //Setup the volume slider
      volumeTimer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(updateVolumeSlider) userInfo:nil repeats:YES];
      [audioPlayer setVolume:volumeSlider.value];
  }
  @end
  </code></pre>
  
  <p>Here is the MainView implementation...</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      //Instantiate performanceArray
      performanceArray = [[NSMutableArray alloc]initWithObjects:@"Centering", nil];
  
      //Instantiate recoveryArray
      recoveryArray = [[NSMutableArray alloc]initWithObjects:@"Power Nap", nil];
  
      //Instantiate the AudioPlayer
      UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:self.tableView.indexPathForSelectedRow];
      NSString *path = [[NSBundle mainBundle] pathForResource:cell.textLabel.text ofType:@"m4a"];
      AudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];    
      [audioPlayer.audioPlayer prepareToPlay];
  }
  </code></pre>