我使用 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];
}
最佳答案
是的,看起来是这样。但由于每封发送的电子邮件总共有 64 个字节,因此您不必担心。
关于iPhone - MessageUI 框架泄露?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10404706/