Mailcore 2错误"此服务器的证书无效." iOS版

Acc*_*ght 1 email ios mailcore mailcore2

我尝试使用以下代码从我的公司电子邮件中通过IMAP协议获取邮件:

MCOIMAPSession *session = [[MCOIMAPSession alloc] init];
[session setHostname:@"imap.mymail.com"];
[session setPort:993];
[session setUsername:@"accidbright@mymail.com"];
[session setPassword:@"password"];
[session setConnectionType:MCOConnectionTypeTLS];
MCOIMAPFetchMessagesOperation * fetchOperation = [session fetchMessagesByUIDOperationWithFolder:inboxFolder requestKind:MCOIMAPMessagesRequestKindHeaders uids:searchResult];
[fetchOperation start:^(NSError *error, NSArray *messages, MCOIndexSet *vanished) {
    if (error) {
        NSLog(@"Fetching all the message subjects error: %@!", error);
    } else {
        NSLog(@"Fetched all the messages subjects!");
    }
}];
Run Code Online (Sandbox Code Playgroud)

我得到错误:

Fetching all the message subjects error: Error Domain=MCOErrorDomain Code=4 
"The certificate for this server is invalid." UserInfo=0x7889ab0 
{NSLocalizedDescription=The certificate for this server is invalid.}!
Run Code Online (Sandbox Code Playgroud)

我知道,我们的邮件是使用域名证书签名的,因此在域外,它是未经验证的证书.但几乎所有使用邮件(fe Mac Mail)的应用程序都有"继续"按钮,这样就可以跳过证书验证并使用邮箱.所以我感兴趣的是有没有可能在MailCore 2中这样做?如果是,我该怎么做?

顺便说一句,当我使用MailCore时,我没有这样的问题.

jun*_*jie 12

你应该在MailCore 2的GitHub页面上真正打开一个问题.尝试:

[session setCheckCertificateEnabled:NO];
Run Code Online (Sandbox Code Playgroud)