我正在使用 MailCore 构建我的电子邮件客户端,并在尝试使用 IMAP 从电子邮件帐户接收消息时遇到了一个小问题。
这是我在 viewDidLoad 中的代码:
CTCoreAccount *account = [[CTCoreAccount alloc] init];
BOOL success = [account connectToServer:@"imap.mail.me.com"
port:993
connectionType:CTConnectionTypePlain
authType:CTImapAuthTypePlain
login:[keychain objectForKey:(__bridge id)kSecAttrAccount]
password:[keychain objectForKey:(__bridge id)kSecValueData]];
if (!success) {
UIAlertView *alertView1 = [[UIAlertView alloc] initWithTitle:@"Error Checking Email" message:@"There was a problem checking your inbox, please try again later." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView1 show];
}
CTCoreFolder *inbox = [account folderWithPath:@"INBOX"];
messages = [inbox messagesFromSequenceNumber:1 to:0 withFetchAttributes:CTFetchAttrEnvelope];
[tableView reloadData];
问题是当我运行我的应用程序时,它没有启动并且我的手机显示空白黑屏。我尝试注释掉代码,一切正常。
谢谢!