用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:@"[email protected]" 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]) {