在我的 iPhone 应用程序中,我使用 SMTP 发送电子邮件。发送邮件时一切正常。但有时在发送邮件后,应用程序突然崩溃并显示以下错误消息
<Warning>: Application 'UIKitApplication:com.myid.smtpsample[0x2630]' exited abnormally with signal 11: Segmentation fault: 11
��May 6 17:07:21 Device-3 ReportCrash[13041] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
这是我的代码:
-(void) sendEmail
{
NSData *imagedata=UIImageJPEGRepresentation(image, 0.2f);
SKPSMTPMessage *Message = [[SKPSMTPMessage alloc] init];
Message.fromEmail = @"my email";
Message.toEmail = receiverEmailString;
Message.relayHost = @"smtp.gmail.com";
Message.requiresAuth = YES;
Message.login = @"my email";
Message.pass = @"my password";
Message.subject = @"Details";
Message.wantsSecure = YES;
Message.delegate = self;
NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",kSKPSMTPPartContentTypeKey,@"Message Body",kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];
NSDictionary *vcfPart= [NSDictionary dictionaryWithObjectsAndKeys:@"image/jpeg;\r\n\tx-unix-mode=0644;\r\n\tname=\"MyPhoto.jpg\"",kSKPSMTPPartContentTypeKey,
@"attachment;\r\n\tfilename=\"MyPhoto.jpg\"",kSKPSMTPPartContentDispositionKey,[imagedata encodeBase64ForData],kSKPSMTPPartMessageKey,@"base64",kSKPSMTPPartContentTransferEncodingKey,nil];
Message.parts = [NSArray arrayWithObjects:plainPart,vcfPart,nil];
[Message send];
}
- (void)messageFailed:(SKPSMTPMessage *)message error:(NSError *)error{
NSLog(@"delegate - error(%d): %@", [error code], [error localizedDescription]);
}
- (void)messageSent:(SKPSMTPMessage *)message{
NSLog(@"delegate - message sent");
}
请告诉我哪里做错了