由Leaks仪器识别的MPMediaickerController内存泄漏

时间:2010-04-01 07:13:55

标签: iphone objective-c

这是Apple的Addmusic示例中的代码。

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];

我在我的应用程序中使用此代码,Leaks仪器突出显示该行的泄漏:

[self presentModalViewController: picker animated: YES];

我认为这是因为此行保留了对随后无法释放的选择器的引用。

有没有办法绕过这个或Leaks错误地识别泄漏?

1 个答案:

答案 0 :(得分:0)

可以通过致电dismissModalViewControllerAnimated:

发布
相关问题