title: Updating the progress bar in iOS 5
body: <p>I am developing an iOS audio player, and I want to implement a progress bar that will indicate the progress of the current song which is playing.
  In my ViewController class, I have 2 double instances - time and duration, and a      AVAudioPlayer instance called background. </p>
  
  <pre><code>- (IBAction)play:(id)sender {
      NSString *filePath = [[NSBundle mainBundle] pathForResource:@"some_song" ofType:@"mp3"];
      NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
      background = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:nil];
      background.delegate = self;
      [background setNumberOfLoops:1];
      [background setVolume:0.5];
      [background play];
      time = 0;
      duration = [background duration];
      while(time &lt; duration){
          [progressBar setProgress: (double) time/duration animated:YES];
          time += 1; 
      } 
  }
  </code></pre>
  
  <p>Could anyone explain what I am doing wrong?
  Thanks in advance.</p>