-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