MPMediaickerController memory leak identified by Leaks instrument
- by Joe
This is code from Apple's Addmusic example.
MPMediaPickerController *picker =
[[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
picker.delegate = self;
picker.allowsPickingMultipleItems = YES;
picker.prompt = NSLocalizedString (@"Add songs to play", "Prompt in media item picker");
// The media item picker uses the default UI style, so it needs a default-style
// status bar to match it visually
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleDefault animated: YES];
[self presentModalViewController: picker animated: YES];
[picker release];
I'm using this code in my app and the Leaks instrument highlights a leak on the line:
[self presentModalViewController: picker animated: YES];
I think that this is because this line retains a reference to picker which cannot be subsequently released.
Is there any way around this or is Leaks incorrectly identifying a leak?