lzb4616 / skpsmtpmessage

Automatically exported from code.google.com/p/skpsmtpmessage
0 stars 0 forks source link

unrecognized selector sent to instance #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I copied in your code to do a test.
 SKPSMTPMessage *testMsg = [[SKPSMTPMessage alloc] init];
    testMsg.fromEmail = @"gps@collinssolutions.com";
    testMsg.toEmail = @"jcollins@collinssolutions.com";
    testMsg.relayHost = @"collinssolutions.com";
    testMsg.requiresAuth = YES;
    testMsg.login = @"gps@collinssolutions.com";
    testMsg.pass = @"taken out for internet post";
    testMsg.subject = @"GPS Download";
    testMsg.bccEmail = @"service@collinssolutions.com";
    testMsg.wantsSecure = NO; // 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 tést 
messåge.",kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey
,nil];
    NSString *vcfPath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"vcf"];
    NSData *vcfData = [NSData dataWithContentsOfFile:vcfPath];

    NSDictionary *vcfPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/directory;\r\n\tx-
unix-mode=0644;\r\n\tname=\"test.vcf\"",kSKPSMTPPartContentTypeKey,

@"attachment;\r\n\tfilename=\"test.vcf\"",kSKPSMTPPartContentDispositionKey,[vcf
Data 
encodeBase64ForData],kSKPSMTPPartMessageKey,@"base64",kSKPSMTPPartContentTransfe
rEnco
dingKey,nil];

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

I get this:
2009-03-22 19:46:41.072 LocateMe[1780:20b] C: Attempting to connect to server 
at: 
collinssolutions.com:25
2009-03-22 19:46:49.092 LocateMe[1780:20b] C: Attempting to connect to server 
at: 
collinssolutions.com:465
2009-03-22 19:46:57.099 LocateMe[1780:20b] C: Attempting to connect to server 
at: 
collinssolutions.com:587
2009-03-22 19:46:57.882 LocateMe[1780:20b] *** stopping watchdog ***
2009-03-22 19:46:57.888 LocateMe[1780:20b] S: 220 bighorn.nexcess.net ESMTP
2009-03-22 19:46:57.893 LocateMe[1780:20b] C: EHLO localhost
2009-03-22 19:46:57.899 LocateMe[1780:20b] *** starting short watchdog ***
2009-03-22 19:46:57.943 LocateMe[1780:20b] *** stopping watchdog ***
2009-03-22 19:46:57.952 LocateMe[1780:20b] S: 250-bighorn.nexcess.net
2009-03-22 19:46:57.963 LocateMe[1780:20b] *** stopping watchdog ***
2009-03-22 19:46:57.973 LocateMe[1780:20b] S: 250-STARTTLS
2009-03-22 19:46:57.984 LocateMe[1780:20b] *** stopping watchdog ***
2009-03-22 19:46:57.994 LocateMe[1780:20b] S: 250-PIPELINING
2009-03-22 19:46:58.005 LocateMe[1780:20b] *** stopping watchdog ***
2009-03-22 19:46:58.017 LocateMe[1780:20b] S: 250-8BITMIME
2009-03-22 19:46:58.027 LocateMe[1780:20b] *** stopping watchdog ***
2009-03-22 19:46:58.035 LocateMe[1780:20b] S: 250-SIZE 20971520
2009-03-22 19:46:58.041 LocateMe[1780:20b] *** stopping watchdog ***
2009-03-22 19:46:58.046 LocateMe[1780:20b] S: 250 AUTH LOGIN PLAIN CRAM-MD5
2009-03-22 19:46:58.080 LocateMe[1780:20b] *** -[MainViewController 
messageFailed:error:]: 
unrecognized selector sent to instance 0x11e9b0
2009-03-22 19:46:58.088 LocateMe[1780:20b] *** Terminating app due to uncaught 
exception 
'NSInvalidArgumentException', reason: '*** -[MainViewController 
messageFailed:error:]: 
unrecognized selector sent to instance 0x11e9b0'
2009-03-22 19:46:58.098 LocateMe[1780:20b] Stack: (
    808221155,
    806100816,
    808224837,
    807957033,
    807851552,
    60763,
    51397,
    812621199,
    808007687,
    808007573,
    808007199,
    824152885,
    808006801,
    808006183,
    807836299,
    807834407,
    827752032,
    816118388,
    816157144,
    8381,
    8244
)
terminate called after throwing an instance of 'NSException'

I am needing to email a sqlite database that is stored in the apps Documents Dir

Original issue reported on code.google.com by jcoll...@collinssolutions.com on 23 Mar 2009 at 12:53

GoogleCodeExporter commented 9 years ago
You need to make sure your MainViewController conforms to the 
SKPSMTPMessageSenderDelegate protocol.

Example: @interface MainViewController : UIViewController 
<SKPSMTPMessageSenderDelegate>

And in your MainViewController.m you need to have both methods from the 
SKPSMTPMessageSenderDelegate:
-(void)messageSent:(SKPSMTPMessageSender *)message;
-(void)messageFailed:(SKPSMTPMessageSender *)message error:(NSError *)error;

This should fix your "unrecognized selector sent to instance" error, although 
it looks like the reason you're 
getting that error is because -(void)messageFailed:(SKPSMTPMessageSender 
*)message error:(NSError *)error; 
is trying to be called. That means there is something deeper to the issue that 
you need to look into.

Original comment by averagejake on 26 Mar 2009 at 6:49