mailcore2 使用代码如下
self.imapSession = [[MCOIMAPSession alloc] init];
<p style="font-size:18px;font-family:Menlo;">
<span> </span>self.imapSession.hostname = hostname;
</p>
<p style="font-size:18px;font-family:Menlo;color:#539AA4;">
<span> </span>self.imapSession.port = 993;
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>self.imapSession.username = username;
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>self.imapSession.password = password;
</p>
<p style="font-size:18px;font-family:Menlo;">
if (oauth2Token != nil) {
</p>
<p style="font-size:18px;font-family:Menlo;">
self.imapSession.OAuth2Token = oauth2Token;
</p>
<p style="font-size:18px;font-family:Menlo;color:#3D1D81;">
self.imapSession.authType = MCOAuthTypeXOAuth2;
</p>
<p style="font-size:18px;font-family:Menlo;">
}
</p>
<p style="font-size:18px;font-family:Menlo;color:#3D1D81;">
<span> </span>self.imapSession.connectionType = MCOConnectionTypeTLS;
</p>
<p style="font-size:18px;font-family:Menlo;">
MasterViewController * __weak weakSelf = self;
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>self.imapSession.connectionLogger = ^(void * connectionID, MCOConnectionLogType type, NSData * data) {
</p>
<p style="font-size:18px;font-family:Menlo;">
@synchronized(weakSelf) {
</p>
<p style="font-size:18px;font-family:Menlo;color:#3D1D81;">
if (type != MCOConnectionLogTypeSentPrivate) {
</p>
<p style="font-size:18px;font-family:Menlo;">
NSLog(@"event logged:%p %i withData: %@", connectionID, type, [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
</p>
<p style="font-size:18px;font-family:Menlo;">
}
</p>
<p style="font-size:18px;font-family:Menlo;">
}
</p>
<p style="font-size:18px;font-family:Menlo;">
};
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>
</p>
<p style="font-size:18px;font-family:Menlo;color:#1D9421;">
<span> </span>// Reset the inbox
</p>
<p style="font-size:18px;font-family:Menlo;color:#539AA4;">
<span> </span>self.messages = nil;
</p>
<p style="font-size:18px;font-family:Menlo;color:#539AA4;">
<span> </span>self.totalNumberOfInboxMessages = -1;
</p>
<p style="font-size:18px;font-family:Menlo;color:#539AA4;">
<span> </span>self.isLoading = NO;
</p>
<p style="font-size:18px;font-family:Menlo;color:#6122AE;">
<span> </span>self.messagePreviews = [NSMutableDictionary dictionary];
</p>
<p style="font-size:18px;font-family:Menlo;color:#3D1D81;">
<span> </span>[self.tableView reloadData];
</p>
<p style="font-size:18px;font-family:Menlo;">
</p>
<p style="font-size:18px;font-family:Menlo;color:#C91B13;">
<span> </span>NSLog(@"checking account");
</p>
<p style="font-size:18px;font-family:Menlo;color:#539AA4;">
<span> </span>self.imapCheckOp = [self.imapSession checkAccountOperation];
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>[self.imapCheckOp start:^(NSError *error) {
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>MasterViewController *strongSelf = weakSelf;
</p>
<p style="font-size:18px;font-family:Menlo;color:#C91B13;">
<span> </span>NSLog(@"finished checking account.");
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>if (error == nil) {
</p>
<p style="font-size:18px;font-family:Menlo;color:#78492A;">
<span> </span>[strongSelf loadLastNMessages:NUMBER_OF_MESSAGES_TO_LOAD];
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>} else {
</p>
<p style="font-size:18px;font-family:Menlo;color:#C91B13;">
<span> </span>NSLog(@"error loading account: %@", error);
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>}
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>strongSelf.imapCheckOp = nil;
</p>
<p style="font-size:18px;font-family:Menlo;">
<span> </span>}];
</p>
<div>
<span style="line-height:1.5;font-size:10pt;">当我升级iOS版本到iOS8.0 后,mailcore2 出现报错,控制台输出:</span>
</div>
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.}
<p></p>
<p style="font-size:18px;font-family:Menlo;">
<b></b>
</p>
<p style="font-size:18px;font-family:Menlo;">
<b>然而在iOS8.1 的设备上报错信息如下</b>
</p>
<p style="font-size:18px;font-family:Menlo;">
<b>
</b></p><p style="font-size:18px;font-family:Menlo;"><b>
<b>
</b></b></p><p style="font-size:18px;font-family:Menlo;"><b><b>
<b>checking account</b>
</b></b></p><b><b>
<p style="font-size:18px;font-family:Menlo;">
<b>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</b>
</p>
<p style="font-size:18px;font-family:Menlo;">
<b></b>
</p>
<p style="font-size:18px;font-family:Menlo;">
<b>2015-02-12 16:24:51.409 MailCoreTest[6543:2647600] event logged:0x17eba640 0 withData: (null)</b>
</p>
<p style="font-size:18px;font-family:Menlo;">
<b>2015-02-12 16:24:51.412 MailCoreTest[6543:2647571] finished checking account.</b>
</p>
<p style="font-size:18px;font-family:Menlo;">
<b>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.}</b>
</p>
以前在iOS7.1 的设备上是没有任何问题的,急需帮助,谢谢
你的解决了么,现在遇到同样的错误,能告诉怎么解决的么你看下邮箱设置
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。