簡體   English   中英

泄漏儀器確定的MPMediaickerController內存泄漏

[英]MPMediaickerController memory leak identified by Leaks instrument

這是來自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];

我認為這是因為此行保留了對選擇器的引用,該引用隨后無法釋放。

有什么辦法可以解決此問題,還是泄漏錯誤地識別泄漏?

可以通過調用dismissModalViewControllerAnimated:來釋放它dismissModalViewControllerAnimated:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM