我正在向用户发送消息。
@objc fileprivate func sendPressed() {
if let text = self.textView?.text {
sendMessage(text: text)
}
}
sendMessage
这样给出...
func sendMessage(text: String) {
let element = XMLElement(name: XMPPConfig.Keys.GLInformation)
element.addAttribute(withName: XMPPConfig.Keys.GLMessageType, stringValue: MessageType.text.rawValue)
sendTheMessage(text, element: element)
}
最后,sendTheMessage
的给出方式为
fileprivate func sendTheMessage(_ body: String, element: XMLElement) {
print("sendMessage \(body)")
let message = XMPPMessage(type: "chat", to: RealmManager.shared.recipientUser?.JID)
message.addAttribute(withName: "id", stringValue: generateUUID())
message.addBody(body)
message.addReceiptRequest()
sendElement(message)
}
但是其他用户无法接收该消息。发送邮件时,打印的日志如下:
RECV: <message xmlns="jabber:client" lang="en" to="2419@xmpp.abcstage.in/7330044482810331514281698"
from="2258@xmpp.abcstage.in" type="error" id="D59B969E-F33E-4FD2-BB4F-3ECD3BFD44B6"><request xmlns="urn:xmpp:receipts"/><error code="406"
type="modify"><not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" lang="en">Your
active privacy list has denied the routing of this stanza.</text></error><body>Kk</body></message>
这种错误的原因可能是什么??
答案 0 :(得分:1)
从您自己发布的日志中:
您的活动隐私列表已拒绝路由此节。