【问题标题】:typing indication in xmpp chat in iphone在 iphone 的 xmpp 聊天中输入指示
【发布时间】:2012-07-18 09:21:30
【问题描述】:

我正在使用 XMPP 开发聊天应用程序。我的问题是,我想发送聊天通知。我尝试了休闲方式,但没有正确。

- (void)sendMessage:(id)sender
{   


    NSString *messageStr =messageField.text;
    if([messageStr length] > 0)
    {

         NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
         NSXMLElement *chatStatus=[NSXMLElement elementWithName:@"composing" xmlns:xmlns_chatstates];

        [body setStringValue:messageStr];
         NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
        [message addAttributeWithName:@"type" stringValue:@"chat"];
        [message addAttributeWithName:@"to" stringValue:jidString];

        [message addChild:chatStatus];
        [message addChild:body];


        [[self xmppStream] sendElement:message];
    }
}

我正在使用上述方法发送消息。但即使我没有输入,它也总是显示输入通知。任何人都可以帮助我。 提前致谢

【问题讨论】:

    标签: iphone xmpp chat


    【解决方案1】:

    根据XEP-0085: Chat State Notifications,您应该发送另一条通知说您已停止输入,例如<active/><paused/>

    【讨论】:

    • 如何发送通知?
    猜你喜欢
    • 2012-07-19
    • 1970-01-01
    • 1970-01-01
    • 2017-05-25
    • 1970-01-01
    • 2014-06-17
    • 1970-01-01
    • 2016-02-02
    • 1970-01-01
    相关资源
    最近更新 更多