iPhone - MessageUI 框架中的泄漏?

Posted

技术标签:

【中文标题】iPhone - MessageUI 框架中的泄漏?【英文标题】:iPhone - Leaks in MessageUI framework? 【发布时间】:2012-05-01 21:34:59 【问题描述】:

我使用 MFMailComposeViewController 在我的应用程序中发送电子邮件。 当我使用 Instruments 运行我的应用程序时, 在我点击发送电子邮件后,我看到了泄漏。

Leaked Object   #   Address Size    Responsible Library Responsible Frame

MutableMessageHeaders,1 0x6be950    32 Bytes    MessageUI   +[MFComposeTypeFactory headersFromDelegate:]

_MFOutgoingMessageBody,1    0x1190ed0   32 Bytes    Message -[MessageWriter createMessageWithPlainTextDocumentsAndAttachments:headers:]

你知道怎么解决吗, 这是 MessageUI 框架中的泄漏吗?

- (void)showMailComposer

        MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
        picker.mailComposeDelegate = self;
        [picker setSubject:@"Subject"];
        NSString *emailBody = @"Email body";
        [picker setMessageBody:emailBody ishtml:NO];
        [self presentModalViewController:picker animated:YES];
        [picker release];


#pragma mark -
#pragma mark Dismiss Mail/SMS view controller

    // Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the 
    // message field with the result of the operation.
    - (void)mailComposeController:(MFMailComposeViewController*)controller 
              didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 

            [self dismissModalViewControllerAnimated:YES];
    

【问题讨论】:

【参考方案1】:

是的,看起来像。但是每封发送的电子邮件总共有 64 个字节,这不是您应该担心的。

【讨论】:

讨厌成为一个snoot。但是,这似乎是一种流行的观点......而且我看到内存泄漏率随着每次操作系统更新而增加。这一切真正意味着用户必须更频繁地重启手机。与此同时,Apple 告诉我们要尽一切努力让用户体验更好......嗯。

以上是关于iPhone - MessageUI 框架中的泄漏?的主要内容,如果未能解决你的问题,请参考以下文章

在 iPhone 上的 MessageUI 中使用 MFMailComposeViewController 从应用程序发送电子邮件

发送邮件时 MFMailcomposeviewcontroller 的内存泄漏

如何解决 xcode(仪器)中的 iPhone 应用程序内存泄漏

IPHONE:使用仪器分析泄漏

iPhone应用程序中的MKMapView内存泄漏

iphone App中的内存泄漏