1

I have a class that provides a Music Player, compiled under ARC. This is the init code:

- (id) init{
  self = [super init];
  runningVolumeNotification = FALSE;

  MPMusicPlayerController *musicPlayer = [MPMusicPlayerController iPodMusicPlayer];
  systemVolume = musicPlayer.volume;

  NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:@"servo" ofType:@"mp3"];
  AVAudioPlayer* p = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:NULL];
  [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
  [p prepareToPlay];
  [p stop];

  return self;

}

Instruments reports a 100% leak on the line:

AVAudioPlayer* p = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:NULL];

enter image description here

I can't figure out where the problem is!

flip79
  • 1,178
  • 2
  • 15
  • 28

0 Answers0