Iphone 使用SMTPSender/SKPSMTPMessage发送电子邮件时出现错误-[nsconcertemutabledata encodeBase64ForData]:无法识别的选择器发送到实例0x6a67190

Iphone 使用SMTPSender/SKPSMTPMessage发送电子邮件时出现错误-[nsconcertemutabledata encodeBase64ForData]:无法识别的选择器发送到实例0x6a67190,iphone,smtp,Iphone,Smtp,我花了两天时间来实现这一点,但没有成功。我正在使用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

我花了两天时间来实现这一点,但没有成功。我正在使用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.*中,它就消失了

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