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