应用程序崩溃与SKPSMTPMessage类

时间:2013-07-09 17:10:18

标签: iphone ios uiviewcontroller smtp dismiss

所以我对这堂课有严重的问题......

目前,当用户实际发送电子邮件时,ActivityIndi​​cator显示......太棒了!!!以及没有冻结的用户界面......太酷了!

问题是,如果用户推送到另一个实际关闭发送电子邮件视图控制器的视图控制器,应用程序崩溃...我注意到我必须等到SECOND“*** stopping watchdog ***”字符串被记录...以及这个“S: 221 2.0.0 closing connection i16sm31117760pag.18 - gsmtp

这是完整的日志,

013-07-09 09:50:50.655 PowerOneApp[29380:c07] C: Attempting to connect to server at: smtp.gmail.com:25
2013-07-09 09:50:50.752 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:50.752 PowerOneApp[29380:c07] S: 220 mx.google.com ESMTP nr8sm18121079pbc.6 - gsmtp
2013-07-09 09:50:50.752 PowerOneApp[29380:c07] C: EHLO localhost
2013-07-09 09:50:50.752 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:50:50.788 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:50.788 PowerOneApp[29380:c07] S: 250-mx.google.com at your service, [70.89.67.1]
2013-07-09 09:50:50.788 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:50.788 PowerOneApp[29380:c07] S: 250-SIZE 35882577
2013-07-09 09:50:50.788 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:50.789 PowerOneApp[29380:c07] S: 250-8BITMIME
2013-07-09 09:50:50.789 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:50.789 PowerOneApp[29380:c07] S: 250-STARTTLS
2013-07-09 09:50:50.789 PowerOneApp[29380:c07] C: STARTTLS
2013-07-09 09:50:50.790 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:50:50.790 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:50.790 PowerOneApp[29380:c07] S: 250 ENHANCEDSTATUSCODES
2013-07-09 09:50:50.832 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:50.832 PowerOneApp[29380:c07] S: 220 2.0.0 Ready to start TLS
2013-07-09 09:50:50.832 PowerOneApp[29380:c07] Beginning TLSv1...
2013-07-09 09:50:50.832 PowerOneApp[29380:c07] C: EHLO localhost
2013-07-09 09:50:51.102 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:50:51.140 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:51.140 PowerOneApp[29380:c07] S: 250-mx.google.com at your service, [70.89.67.1]
2013-07-09 09:50:51.140 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:51.140 PowerOneApp[29380:c07] S: 250-SIZE 35882577
2013-07-09 09:50:51.141 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:51.141 PowerOneApp[29380:c07] S: 250-8BITMIME
2013-07-09 09:50:51.141 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:51.141 PowerOneApp[29380:c07] S: 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
2013-07-09 09:50:51.141 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:51.142 PowerOneApp[29380:c07] S: 250 ENHANCEDSTATUSCODES
2013-07-09 09:50:51.142 PowerOneApp[29380:c07] C: AUTH PLAIN AGpzZXR0aW5nMzIARm9vdGJhbGwzMyE=
2013-07-09 09:50:51.142 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:50:51.983 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:51.983 PowerOneApp[29380:c07] S: 235 2.7.0 Accepted
2013-07-09 09:50:51.983 PowerOneApp[29380:c07] C: MAIL FROM:<jsetting32@icloud.com> BODY=8BITMIME
2013-07-09 09:50:51.983 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:50:52.025 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:52.025 PowerOneApp[29380:c07] S: 250 2.1.0 OK nr8sm18121079pbc.6 - gsmtp
2013-07-09 09:50:52.025 PowerOneApp[29380:c07] C: RCPT TO:<jsetting32@gmail.com>
2013-07-09 09:50:52.025 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:50:52.069 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:52.069 PowerOneApp[29380:c07] S: 250 2.1.5 OK nr8sm18121079pbc.6 - gsmtp
2013-07-09 09:50:52.069 PowerOneApp[29380:c07] C: DATA
2013-07-09 09:50:52.069 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:50:53.220 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:53.220 PowerOneApp[29380:c07] S: 354  Go ahead nr8sm18121079pbc.6 - gsmtp
2013-07-09 09:50:53.221 PowerOneApp[29380:c07] *** starting long watchdog ***
2013-07-09 09:50:54.700 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:54.700 PowerOneApp[29380:c07] S: 250 2.0.0 OK 1373388654 nr8sm18121079pbc.6 - gsmtp
2013-07-09 09:50:54.700 PowerOneApp[29380:c07] C: QUIT
2013-07-09 09:50:54.701 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:50:54.734 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:50:54.734 PowerOneApp[29380:c07] S: 221 2.0.0 closing connection nr8sm18121079pbc.6 - gsmtp
2013-07-09 09:50:58.656 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.190 PowerOneApp[29380:c07] C: Attempting to connect to server at: smtp.gmail.com:25
2013-07-09 09:51:11.276 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.276 PowerOneApp[29380:c07] S: 220 mx.google.com ESMTP i16sm31117760pag.18 - gsmtp
2013-07-09 09:51:11.276 PowerOneApp[29380:c07] C: EHLO localhost
2013-07-09 09:51:11.277 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:51:11.317 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.318 PowerOneApp[29380:c07] S: 250-mx.google.com at your service, [70.89.67.1]
2013-07-09 09:51:11.318 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.318 PowerOneApp[29380:c07] S: 250-SIZE 35882577
2013-07-09 09:51:11.318 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.318 PowerOneApp[29380:c07] S: 250-8BITMIME
2013-07-09 09:51:11.319 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.319 PowerOneApp[29380:c07] S: 250-STARTTLS
2013-07-09 09:51:11.319 PowerOneApp[29380:c07] C: STARTTLS
2013-07-09 09:51:11.319 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:51:11.320 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.320 PowerOneApp[29380:c07] S: 250 ENHANCEDSTATUSCODES
2013-07-09 09:51:11.354 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.354 PowerOneApp[29380:c07] S: 220 2.0.0 Ready to start TLS
2013-07-09 09:51:11.355 PowerOneApp[29380:c07] Beginning TLSv1...
2013-07-09 09:51:11.355 PowerOneApp[29380:c07] C: EHLO localhost
2013-07-09 09:51:11.644 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:51:11.680 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.680 PowerOneApp[29380:c07] S: 250-mx.google.com at your service, [70.89.67.1]
2013-07-09 09:51:11.680 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.680 PowerOneApp[29380:c07] S: 250-SIZE 35882577
2013-07-09 09:51:11.680 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.681 PowerOneApp[29380:c07] S: 250-8BITMIME
2013-07-09 09:51:11.681 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.681 PowerOneApp[29380:c07] S: 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
2013-07-09 09:51:11.681 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:11.682 PowerOneApp[29380:c07] S: 250 ENHANCEDSTATUSCODES
2013-07-09 09:51:11.682 PowerOneApp[29380:c07] C: AUTH PLAIN AGpzZXR0aW5nMzIARm9vdGJhbGwzMyE=
2013-07-09 09:51:11.682 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:51:12.462 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:12.463 PowerOneApp[29380:c07] S: 235 2.7.0 Accepted
2013-07-09 09:51:12.463 PowerOneApp[29380:c07] C: MAIL FROM:<jsetting32@icloud.com> BODY=8BITMIME
2013-07-09 09:51:12.463 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:51:12.502 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:12.503 PowerOneApp[29380:c07] S: 250 2.1.0 OK i16sm31117760pag.18 - gsmtp
2013-07-09 09:51:12.503 PowerOneApp[29380:c07] C: RCPT TO:<jsetting32@gmail.com>
2013-07-09 09:51:12.503 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:51:12.544 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:12.544 PowerOneApp[29380:c07] S: 250 2.1.5 OK i16sm31117760pag.18 - gsmtp
2013-07-09 09:51:12.544 PowerOneApp[29380:c07] C: DATA
2013-07-09 09:51:12.544 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:51:13.102 PowerOneApp[29380:c07] Let us know about a broken feature
2013-07-09 09:51:13.289 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:13.289 PowerOneApp[29380:c07] S: 354  Go ahead i16sm31117760pag.18 - gsmtp
2013-07-09 09:51:13.290 PowerOneApp[29380:c07] *** starting long watchdog ***
2013-07-09 09:51:14.751 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:14.751 PowerOneApp[29380:c07] S: 250 2.0.0 OK 1373388674 i16sm31117760pag.18 - gsmtp
2013-07-09 09:51:14.751 PowerOneApp[29380:c07] C: QUIT
2013-07-09 09:51:14.751 PowerOneApp[29380:c07] *** starting short watchdog ***
2013-07-09 09:51:14.792 PowerOneApp[29380:c07] *** stopping watchdog ***
2013-07-09 09:51:14.793 PowerOneApp[29380:c07] S: 221 2.0.0 closing connection i16sm31117760pag.18 - gsmtp

现在,我“真的很快”退出发送电子邮件的视图并继续发送电子邮件,然后我收到此消息*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType messageSent:]: unrecognized selector sent to instance 0xa0a8e50'

当我使用[testMsg performSelectorOnBackgroundThread:@selector(send) withObject:nil];

时会发生这种情况

但是当我使用[testMsg performSelectorOnMainThread:@selector(send) withObject:nil waitUntilDone:YES];时,我得到的问题与首先发布的日志语句相同......

对不起我的可怕措辞,但我对这个错误感到有些沮丧:(。

1 个答案:

答案 0 :(得分:1)

我想这个错误不在于通过SMTP发送邮件。在调用messageSent:delegate方法之前,似乎已释放委托对象。

我的建议是在Application Delegate中执行SKPSMTPMessage发送操作。如果您不希望SMTP消息发送句柄位于app-delegate中,请保留您的委托对象,直到邮件已发送或将委托对象设置为nil,当委托对象被取消分配时。

希望有所帮助