我是xcode的新手,现在使用Xcode 6.3.2创建一个带MailCore2
的应用程序来发送电子邮件。每次我为MCOSMTPSession
,MCOMessageBuilder
或MCOAddress
创建变量时,此变量始终为'nil'
。为了加快速度,我将在这里复制我的代码。
MCOSMTPSession *smtpSession = [[MCOSMTPSession alloc] init];
smtpSession.hostname = smtpServer;
smtpSession.port = (unsigned int)smtpPort;
smtpSession.username = fromAddress;
smtpSession.password = fromPass;
smtpSession.connectionType = MCOConnectionTypeTLS;
MCOMessageBuilder *builder = [[MCOMessageBuilder alloc] init];
MCOAddress *from = [MCOAddress addressWithMailbox:fromAddress];
NSMutableArray *toAddresses = [[NSMutableArray alloc] init];
MCOAddress *to = [MCOAddress addressWithMailbox:toAddress];
[toAddresses addObject:to];
[[builder header] setFrom:from];
[[builder header] setTo:toAddresses];
[[builder header] setSubject:@"[Biz Cards App]"];
[builder setTextBody:[self.txtNotes text]];
NSData * rfc822Data = [builder data];
smtpSession,builder,from和to init在我执行init之后总是没有。在这种情况下,有谁可以帮助我?任何帮助将不胜感激。谢谢。
通过使用此Library将MailCore2添加为静态库,修复了上述问题。
现在我在访问时遇到错误
NSData * rfc822Data = [builder data];
我没有进一步的线索,因为日志没有显示任何内容。谢谢你的帮助。