iPhone- 使用 SKPSMTPMessage 的应用程序崩溃
Posted
技术标签:
【中文标题】iPhone- 使用 SKPSMTPMessage 的应用程序崩溃【英文标题】:iPhone- App crash using SKPSMTPMessage 【发布时间】:2012-09-04 05:52:03 【问题描述】:我正在使用 SKPSMTPMessage 发送电子邮件。它在模拟器中运行良好,但是当我在 iPad 上尝试时,它会发送邮件,但之后它会崩溃。 我的中继主机是
testMsg.relayHost = @"smtp.gmail.com"
问题出在哪里?? 谁能帮帮我
提前致谢
编辑: 错误:
2012-09-11 16:10:02.824[2902:707] C: Attempting to connect to server at: smtp.gmail.com:25
2012-09-11 16:10:03.368 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:03.370 [2902:707] S: 220 mx.google.com ESMTP iq3sm9573874pbc.5
2012-09-11 16:10:03.371 [2902:707] C: EHLO localhost
2012-09-11 16:10:03.373 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:03.475 [2902:707] 0
2012-09-11 16:10:03.476 [2902:707] 0
2012-09-11 16:10:03.522 [2902:707] 0
2012-09-11 16:10:03.854 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:03.855 [2902:707] S: 250-mx.google.com at your service, [112.196.5.2]
2012-09-11 16:10:03.856 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:03.857 [2902:707] S: 250-SIZE 35882577
2012-09-11 16:10:03.858 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:03.858 [2902:707] S: 250-8BITMIME
2012-09-11 16:10:03.859 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:03.861 [2902:707] S: 250-STARTTLS
2012-09-11 16:10:03.862 [2902:707] C: STARTTLS
2012-09-11 16:10:03.863 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:03.864 [2902:707] *** stopping watchdog ***
2 012-09-11 16:10:03.865 [2902:707] S: 250 ENHANCEDSTATUSCODES
2012-09-11 16:10:04.108 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:04.110 [2902:707] S: 220 2.0.0 Ready to start TLS
2012-09-11 16:10:04.112 [2902:707] Beginning TLSv1...
2012-09-11 16:10:04.113 [2902:707] C: EHLO localhost
2012-09-11 16:10:05.088 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:05.332 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:05.334 [2902:707] S: 250-mx.google.com at your service, [112.196.5.2]
2012-09-11 16:10:05.335 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:05.336 [2902:707] S: 250-SIZE 35882577
2012-09-11 16:10:05.337 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:05.337 [2902:707] S: 250-8BITMIME
2012-09-11 16:10:05.338 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:05.339 [2902:707] S: 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
2012-09-11 16:10:05.340 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:05.340 [2902:707] S: 250 ENHANCEDSTATUSCODES
2012-09-11 16:10:05.341 [2902:707] C: AUTH PLAIN AGJyZWFraW4ucmVwb3J0QGdtYWlsLmNvbQBicmVha2luLnJlcG9ydA==
2012-09-11 16:10:05.342 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:06.074 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:06.075 [2902:707] S: 235 2.7.0 Accepted
2012-09-11 16:10:06.077 [2902:707] C: MAIL FROM:<xyz@gmail.com> BODY=8BITMIME
2012-09-11 16:10:06.078 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:06.321 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:06.323 [2902:707] S: 250 2.1.0 OK iq3sm9573874pbc.5
2012-09-11 16:10:06.324 [2902:707] C: RCPT TO:<abc@com>
2012-09-11 16:10:06.326 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:06.566 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:06.568 [2902:707] S: 250 2.1.5 OK iq3sm9573874pbc.5
2012-09-11 16:10:06.569 [2902:707] C: DATA
2012-09-11 16:10:06.570 [2902:707] *** starting short watchdog ***
2012-09-11 16:10:07.644 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:07.646 [2902:707] S: 354 Go ahead iq3sm9573874pbc.5
2012-09-11 16:10:07.656 [2902:707] *** starting long watchdog ***
2012-09-11 16:10:12.645 [2902:707] *** stopping watchdog ***
2012-09-11 16:10:12.647 [2902:707] *** stopping watchdog ***
(lldb)
这里 self.watchdogTimer = nil; EXC_BAD_ACCESS
【问题讨论】:
【参考方案1】:两年后我也遇到过这个问题。可能对某人有用我的解决方案:
@implementation SMTPEmailManager
SKPSMTPMessage* _smtpMessage;
- (void) sendMessage
...
_smtpMessage = [[SKPSMTPMessage alloc] init];
_smtpMessage.relayHost = @"smtp.gmail.com";
...
[_smtpMessage send];
- (void) messageSent: (SKPSMTPMessage*) message
_smtpMessage = nil;
...
【讨论】:
【参考方案2】:您是否将任何附件与您的电子邮件一起发送?如果是,那么您必须使用相关的 MIME 类型。
【讨论】:
是的,我正在通过电子邮件发送图像......它在模拟器和 ipod 中工作,但在 ipad 中崩溃 是在发送邮件之前还是之后崩溃.. 你能显示错误日志吗 我不确定您的代码是否有任何问题。如果代码有任何问题,那么它也会在 iPod 中崩溃。尝试使用异常处理。 在哪里可以找到解决此问题的方法?我觉得我在发送短信时遇到了同样的问题。 如果用户在处理过程中从发送电子邮件视图中退出...应用程序在到达最后一个 ***stopping watchdog *** 时崩溃。任何我在 [self parseBuffer] 上得到 EXC_BAD_ACCESS;行以及 [delegate messageSent:self];以上是关于iPhone- 使用 SKPSMTPMessage 的应用程序崩溃的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 skpsmtpmessage 正确附加 plist 文件?
为啥这个使用 SKPSMTPMessage 的应用程序被拒绝了?
使用 SKPSMTPMessage 时 encodeBase64ForData 和 encodeWrappedBase64ForData 有啥区别