gpt4 book ai didi

iphone - 使用 SMTPSender/SKPSMTPMessage 发送电子邮件给出错误 -[NSConcreteMutableDataencodeBase64ForData] : unrecognized selector sent to instance 0x6a67190

转载 作者:行者123 更新时间:2023-12-03 20:08:53 25 4
gpt4 key购买 nike

我花了两天时间来实现这个,但没有成功。我正在使用 http://code.google.com/p/skpsmtpmessage/source/checkout 中的 SMTPSender 项目代码...演示项目完美运行!但是当我将类文件复制到我的项目时(如说明所示),它可以正常构建并运行。但是当我尝试发送电子邮件时......它给出了以下错误。

C: Attempting to connect to server at: smtp.gmail.com:25
2011-04-21 17:42:29.183 LocaliphoneAppRequest[5517:207] C: Attempting to connect to server at: smtp.gmail.com:465
2011-04-21 17:42:37.183 LocaliphoneAppRequest[5517:207] C: Attempting to connect to server at: smtp.gmail.com:587
2011-04-21 17:42:37.546 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.549 LocaliphoneAppRequest[5517:207] S: 220 mx.google.com ESMTP l5sm941912wej.32
2011-04-21 17:42:37.553 LocaliphoneAppRequest[5517:207] C: EHLO localhost
2011-04-21 17:42:37.557 LocaliphoneAppRequest[5517:207] *** starting short watchdog ***
2011-04-21 17:42:37.741 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.742 LocaliphoneAppRequest[5517:207] S: 250-mx.google.com at your service, [119.153.117.81]
2011-04-21 17:42:37.743 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.744 LocaliphoneAppRequest[5517:207] S: 250-SIZE 35882577
2011-04-21 17:42:37.745 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.747 LocaliphoneAppRequest[5517:207] S: 250-8BITMIME
2011-04-21 17:42:37.748 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.749 LocaliphoneAppRequest[5517:207] S: 250-STARTTLS
2011-04-21 17:42:37.754 LocaliphoneAppRequest[5517:207] C: STARTTLS
2011-04-21 17:42:37.755 LocaliphoneAppRequest[5517:207] *** starting short watchdog ***
2011-04-21 17:42:37.756 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.759 LocaliphoneAppRequest[5517:207] S: 250 ENHANCEDSTATUSCODES
2011-04-21 17:42:37.937 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:37.939 LocaliphoneAppRequest[5517:207] S: 220 2.0.0 Ready to start TLS
2011-04-21 17:42:37.942 LocaliphoneAppRequest[5517:207] Beginning TLSv1...
2011-04-21 17:42:37.944 LocaliphoneAppRequest[5517:207] C: EHLO localhost
2011-04-21 17:42:38.675 LocaliphoneAppRequest[5517:207] *** starting short watchdog ***
2011-04-21 17:42:38.861 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:38.861 LocaliphoneAppRequest[5517:207] S: 250-mx.google.com at your service, [119.153.117.81]
2011-04-21 17:42:38.863 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:38.864 LocaliphoneAppRequest[5517:207] S: 250-SIZE 35882577
2011-04-21 17:42:38.867 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:38.869 LocaliphoneAppRequest[5517:207] S: 250-8BITMIME
2011-04-21 17:42:38.872 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:38.874 LocaliphoneAppRequest[5517:207] S: 250-AUTH LOGIN PLAIN XOAUTH
2011-04-21 17:42:38.875 LocaliphoneAppRequest[5517:207] *** stopping watchdog ***
2011-04-21 17:42:38.879 LocaliphoneAppRequest[5517:207] S: 250 ENHANCEDSTATUSCODES
2011-04-21 17:42:38.880 LocaliphoneAppRequest[5517:207] -[NSConcreteMutableData encodeBase64ForData]: unrecognized selector sent to instance 0x6a67190
2011-04-21 17:42:38.914 LocaliphoneAppRequest[5517:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteMutableData encodeBase64ForData]: unrecognized selector sent to instance 0x6a67190'

我的代码是

SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];
testMsg.fromEmail = @"mygmail@gmail.com";
testMsg.toEmail = @"myanothergmail@gmail.com";
testMsg.relayHost = @"smtp.gmail.com";
testMsg.requiresAuth = YES;
testMsg.login = @"mygmail@gmail.com";
testMsg.pass = @"mypass";
testMsg.subject = @"test message";
// testMsg.bccEmail = @"testbcc@test.com";
testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS!

// Only do this for self-signed certs!
// testMsg.validateSSLChain = NO;
testMsg.delegate = self;

NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey,
@"This is a test message.",kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];

testMsg.parts = [NSArray arrayWithObjects:plainPart,nil];

[testMsg send];

请帮帮我......:(

最佳答案

当我第一次开始使用 SKPSMTPMessage 时,我遇到了这个问题。我忘记了细节或从哪里得到原始答案,但我将 NSStream+SKPSMTPExtensions.* 包装到 SKPSMTPMessage.* 中,然后它就消失了。

只需将接口(interface)和实现放在导入之后、NSStream (SKPSMTPExtensions) 的其余代码之前。

关于iphone - 使用 SMTPSender/SKPSMTPMessage 发送电子邮件给出错误 -[NSConcreteMutableDataencodeBase64ForData] : unrecognized selector sent to instance 0x6a67190,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5744335/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com