0
在我目前正在使用的应用程序中,我使用Mailcore(http://www.mronge.com/m/MailCore/API/)来处理邮件服务器操作。我试图通过后台的SMTP连接发送消息。问题是,Leaks告诉我,每次发送消息时都会遇到大量内存泄漏。我试图找出这是我的错还是Mailcore的错。下面的代码:iPhone和Mailcore内存泄漏问题
从我的视图控制器:
-(void) send_rfq {
CTCoreMessage *repMsg = [[[CTCoreMessage alloc] init] autorelease];
NSDate *now = [NSDate date];
NSString* msgString = [NSString stringWithFormat:@"Date#%@\nRFQ#%@\nSalesRep#%@",[now description], [rfq_entry get_uid],[rfq_entry get_repid]];
[repMsg setBody:msgString];
[repMsg setSubject:@"RFQ Assign"];
[myAppDelegate performSelectorInBackground:@selector(send_msg:) withObject:repMsg];
[self.navigationController popViewControllerAnimated:YES];
}
从我的应用程序的委托:
-(BOOL) send_bg:(CTCoreMessage*) msg {
BOOL success = TRUE;
@try {
[CTSMTPConnection sendMessage:msg server:smtp_server username:smtp_uname password:smtp_pass port:smtp_port useTLS:smtp_tls useAuth:smtp_auth];
}
@catch (NSException * e) {
//Msg failed to send;
success = FALSE;
}
return success;
}
-(void) send_msg:(CTCoreMessage*) msg {
NSAutoreleasePool *pool = [ [NSAutoreleasePool alloc] init];
[msg setTo:[NSSet setWithObject:[CTCoreAddress addressWithName:@"testaccount" email:rfq_dest]]];
[msg setFrom:[NSSet setWithObject:[CTCoreAddress addressWithName:@"RFQapp" email:rfq_src]]];
if(![self send_bg:msg]) {
UIAlertView * empty_alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Could not send." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[empty_alert show];
[empty_alert autorelease];
}
[pool release];
}
当我运行“构建和分析”,没有分析仪结果返回。 我会试着运行仪器和分析,但是这看起来像库问题? – Poff 2011-01-07 20:37:32