问题描述
- 用mailCode写邮箱客户端时出问题
-
用mailCode写了一个邮箱客户端,写了如下代码:CTCoreAccount *account = [[CTCoreAccount alloc] init]; CTCoreFolder *folder; BOOL success=[account connectToServer:@"imap.qq.com" port:143 connectionType:CONNECTION_TYPE_PLAIN authType:IMAP_AUTH_TYPE_PLAIN login:@"1029418889@qq.com" password:@"****"]; if(!success){ NSLog(@"error"); } folder = [account folderWithPath:@"INBOX"]; for (CTCoreMessage *msg in [folder messageObjectsFromIndex:0 toIndex:10]) { NSLog(@"%@" , msg.subject); }
运行之后就会提示:
In the for{} block messageObjectsFromIndex:toIndex not found!
是不是这个方法没在MailCode中?
解决方案
用messagesFromSequenceNumber:to:withFetchAttributes
:
代码应该是这样:
for (CTCoreMessage *msg in [folder messagesFromSequenceNumber:1 to:0 withFetchAttributes:CTFetchAttrEnvelope]) {
时间: 2024-12-22 16:20:27