使用 Mailcore 2,我可以访问 Yahoo 几乎所有文件夹的消息,但是当我尝试使用 gmail 时,它只能访问 Inbox 文件夹消息。请任何人知道出了什么问题。
这是我的代码
if ([dict count] > 0)
{
myAccountsession = [[MCOIMAPSession alloc] init];
[myAccountsession setHostname:[dict objectForKey:@"incomingserver"]];
[myAccountsession setPort:993];
[myAccountsession setUsername:[dict objectForKey:@"email"]];
[myAccountsession setPassword:[dict objectForKey:@"password"]];
[myAccountsession setConnectionType:MCOConnectionTypeTLS];
}
MCOIMAPMessagesRequestKind requestKind = (MCOIMAPMessagesRequestKind)
(MCOIMAPMessagesRequestKindHeaders | MCOIMAPMessagesRequestKindStructure |
MCOIMAPMessagesRequestKindInternalDate | MCOIMAPMessagesRequestKindHeaderSubject |
MCOIMAPMessagesRequestKindFlags);
NSString *folder = foldernamestring;
NSLog(@"foldername to fetch mails %@",folder);
MCOIMAPFolderInfoOperation *inboxFolderInfo = [myAccountsession folderInfoOperation:foldernamestring];
[inboxFolderInfo start:^(NSError *error, MCOIMAPFolderInfo *info)
{
//access messages in folder..
}];