开发者社区> 问答> 正文

有关mailcore2 的使用?报错

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 的设备上是没有任何问题的,急需帮助,谢谢


展开
收起
爱吃鱼的程序员 2020-06-14 17:50:46 494 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    你的解决了么,现在遇到同样的错误,能告诉怎么解决的么你看下邮箱设置

    2020-06-14 17:51:01
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载