-2
我使用MailCore建立我的电子邮件客户端,跑进一个小问题,同时尽量使用IMAP的电子邮件帐户接收邮件。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];
问题是,当我跑我的应用程序,它不会启动和我的手机显示黑屏。我试着评论这些代码,并且一切正常。
谢谢!
@ranjha正如我所说,这可能是阻塞主线程,并可能是对App Store的拒绝理由。 – 2013-03-22 23:27:20