gpt4 book ai didi

ios - Swift:出现错误 "A stable connection to the server could not be established."

转载 作者:行者123 更新时间:2023-11-30 13:09:00 26 4
gpt4 key购买 nike

我一直在尝试在 iOS 项目上将 Mailcore2 与 Swift 结合使用。

session.hostname = ""
session.port = 993
session.authType = MCOAuthType.XOAuth2
session.connectionType = MCOConnectionType.TLS
session.checkCertificateEnabled = false
session.username = ""
session.password = ""
var requestKind: MCOIMAPMessagesRequestKind = MCOIMAPMessagesRequestKind.Headers
var folder: String = "INBOX"
var uids: MCOIndexSet = MCOIndexSet(range: MCORangeMake(1, UINT64_MAX))
var fetchOperation: MCOIMAPFetchMessagesOperation = session.fetchMessagesOperationWithFolder(folder, requestKind: requestKind, uids: uids)
fetchOperation.start({(error: NSError?, fetchedMessages: [AnyObject]?, vanishedMessages: MCOIndexSet?) -> Void in
if error != nil {
print("Error downloading message headers:\(error!)")
}
//And, let's print out the messages...
print("The post man delivereth:\(fetchedMessages)")
})

这是我一直在尝试使用的代码,这是 MailCore2 页面上提供的代码。我已经对 Gmail、Yahoo Mail 和 Mail.com 进行了测试,但这三个都不起作用。我收到以下错误:

CFNetwork SSLHandshake failed (-9806)
Error downloading message headers:Error Domain=MCOErrorDomain Code=1 "A stable connection to the server could not be established." UserInfo={NSLocalizedDescription=A stable connection to the server could not be established.}

最佳答案

找不到我看到此内容的链接,但您可以安全地删除 session.authTypesession.checkCertificateEnabled 可能也不是必需的。

另请注意,如果您尝试在 Gmail 中使用此功能,则可能需要允许安全性较低的应用程序:https://support.google.com/accounts/answer/6010255 .

关于ios - Swift:出现错误 "A stable connection to the server could not be established.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38959297/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com