3

我使用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];
    }
4

1 回答 1

1

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

于 2012-05-01T21:53:33.737 回答