有关mailcore2 的使用

Hi你好 发布于 2015/02/12 16:27
阅读 2K+
收藏 0

mailcore2 使用代码如下

self.imapSession = [[MCOIMAPSession alloc] init];

self.imapSession.hostname = hostname;

self.imapSession.port = 993;

self.imapSession.username = username;

self.imapSession.password = password;

    if (oauth2Token != nil) {

        self.imapSession.OAuth2Token = oauth2Token;

        self.imapSession.authType = MCOAuthTypeXOAuth2;

    }

self.imapSession.connectionType = MCOConnectionTypeTLS;

    MasterViewController * __weak weakSelf = self;

self.imapSession.connectionLogger = ^(void * connectionID, MCOConnectionLogType type, NSData * data) {

        @synchronized(weakSelf) {

            if (type != MCOConnectionLogTypeSentPrivate) {

                NSLog(@"event logged:%p %i withData: %@", connectionID, type, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);

            }

        }

    };

// Reset the inbox

self.messages = nil;

self.totalNumberOfInboxMessages = -1;

self.isLoading = NO;

self.messagePreviews = [NSMutableDictionary dictionary];

[self.tableView reloadData];

    

NSLog(@"checking account");

self.imapCheckOp = [self.imapSession checkAccountOperation];

[self.imapCheckOp start:^(NSError *error) {

MasterViewController *strongSelf = weakSelf;

NSLog(@"finished checking account.");

if (error == nil) {

[strongSelf loadLastNMessages:NUMBER_OF_MESSAGES_TO_LOAD];

} else {

NSLog(@"error loading account: %@", error);

}

strongSelf.imapCheckOp = nil;

}];

当我升级iOS版本到iOS8.0 后,mailcore2 出现报错,控制台输出:

checking account

2015-02-12 16:25:49.222 MailCoreTest[7755:1695240] finished checking account.

2015-02-12 16:25:49.223 MailCoreTest[7755:1695240] error loading account: Error Domain=MCOErrorDomain Code=1 "A stable connection to the server could not be established." UserInfo=0x1758d720 {NSLocalizedDescription=A stable connection to the server could not be established.}

然而在iOS8.1 的设备上报错信息如下

checking account

2015-02-12 16:24:51.246 MailCoreTest[6543:2647600] event logged:0x17eba640 0 withData: * OK [CAPABILITY IMAP4 IMAP4rev1 IDLE XAPPLEPUSHSERVICE ID UIDPLUS AUTH=LOGIN NAMESPACE] QQMail IMAP4Server ready

2015-02-12 16:24:51.409 MailCoreTest[6543:2647600] event logged:0x17eba640 0 withData: (null)

2015-02-12 16:24:51.412 MailCoreTest[6543:2647571] finished checking account.

2015-02-12 16:24:51.413 MailCoreTest[6543:2647571] error loading account: Error Domain=MCOErrorDomain Code=5 "Unable to authenticate with the current session's credentials." UserInfo=0x17eb4400 {NSLocalizedDescription=Unable to authenticate with the current session's credentials.}

以前在iOS7.1 的设备上是没有任何问题的,急需帮助,谢谢


加载中
0
shidaying
shidaying
你的解决了么,现在遇到同样的错误,能告诉怎么解决的么
0
H
Hi你好
你看下邮箱设置
返回顶部
顶部