我的应用程序通过 MailCore 框架使用 SMTP 将信息发送到 gmail 帐户。由于与 IPv6 不兼容而被拒绝。在苹果的崩溃说明中,它指出“无法加载 MailCore 库”。 Github 指出 MailCore2 框架已经与 IPv6 兼容,所以我不确定问题是什么。
我在将 MailCore.framework 添加到“嵌入式二进制文件”部分后重新提交,但不确定这是否会解决此问题。
我附上了屏幕截图以帮助澄清。感谢您的帮助!
代码:
let smtpSession = MCOSMTPSession()
smtpSession.hostname = "smtp.gmail.com"
smtpSession.username = "sampleUsername"
smtpSession.password = "samplePassword"
smtpSession.port = 465
smtpSession.authType = MCOAuthType.saslPlain
smtpSession.connectionType = MCOConnectionType.TLS
smtpSession.connectionLogger = {(connectionID, type, data) in
if data != nil {
if let string = NSString(data: data!, encoding: String.Encoding.utf8.rawValue){
NSLog("Connectionlogger: \(string)")
最佳答案
这应该有效。我还创建了一个视频以帮助将来的其他人: https://www.youtube.com/watch?v=NkpLqNN8xtU
let smtpSession = MCOSMTPSession()
smtpSession.hostname = "smtp.gmail.com"
smtpSession.username = "charlesxavier1221@gmail.com"
smtpSession.password = "fakepassword1234"
smtpSession.port = 465
smtpSession.authType = MCOAuthType.saslPlain
smtpSession.connectionType = MCOConnectionType.TLS
smtpSession.connectionLogger = {(connectionID, type, data) in
if data != nil {
if let string = NSString(data: data!, encoding: String.Encoding.utf8.rawValue){
NSLog("Connectionlogger: \(string)")
}
}
}
关于ios - MailCore/MailCore2 库未加载 - IPv6 兼容性失败 - Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40119863/