0
iOS 용 XMPPFramework과 관련하여 메시지의 날짜와 시간을 표시해야합니다. 일부 검색 후 XMPPAutoTime
모듈을 사용해야한다고 생각하지만 몇 가지 예제를 찾지 못했습니다.XMPP 메시지 시간
xmppAutoTime = [[XMPPAutoTime alloc] initWithDispatchQueue:dispatch_get_main_queue()];
[xmppAutoTime activate:self.xmppStream];
내 메시지를 보내는 방법은 다음과 같습니다 :
나는 스트림 설정에 사용
NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
[message addAttributeWithName:@"type" stringValue:@"chat"];
[message addAttributeWithName:@"to" stringValue:to];
[message addChild:[XMPPTime timeElement]];
NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
[body setStringValue:text];
[message addChild:body];
그리고 내 XML은 다음과 같습니다 당신은 내가 볼 수 그래서
<message type="chat" to="toJID">
<time xmlns="urn:xmpp:time">
<tzo>+03:00</tzo>
<utc>2014-12-30T15:24:22Z</utc>
</time>
<body>message text</body>
</message>
시간이 있고 정확한 것입니다. 문제는 내가 너무 XMPP에서 일하고 있어요 XMPPMessage
- (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message