【问题标题】:Custom XMPP IQ in iOS XMPP FrameworkiOS XMPP 框架中的自定义 XMPP IQ
【发布时间】:2014-05-13 08:26:01
【问题描述】:

我想在 iOS 中使用 xmpp 框架为以下 XML 发送自定义 IQ:

<iq type="get">
<questionrequest xmlns="xyz" group="abc">
</questionrequest>
</iq>

我在 iOS 中使用了以下代码:

XMPPIQ *iq = [[XMPPIQ alloc] initWithType:@"get"];
DDXMLElement *query = [DDXMLElement elementWithName:@"questionrequest" xmlns:@"xyz" group:@"abc"];
[iq addChild:query];
[[[self appDelegate] xmppStream] sendElement:iq];
NSLog(@"iq: %@", [iq prettyXMLString]);

当我在 DDXMLElement *query 中添加 group="abc"> 部分时出现错误。请帮忙。

【问题讨论】:

    标签: ios xcode xmppframework


    【解决方案1】:

    它通过使用以下代码工作:

    XMPPIQ *iq = [[XMPPIQ alloc] initWithType:@"get"];
        DDXMLElement *query = [DDXMLElement elementWithName:@"questionrequest" xmlns:@"naseebprofile"];
        [query addAttributeWithName:@"group" stringValue:@"Tastes"];
        [iq addChild:query];
        [[[self appDelegate] xmppStream] sendElement:iq];
    

    【讨论】:

    • 我在 iOS 中创建了一个应用程序并从 xmpp 连接和获取用户,并且也能够获取离线消息。现在我需要使用 XEP-0313 获取特定用户的对话,如何实现 XEP-第0313章
    • @MaheshNarla 您可以通过查询特定 JID 来做到这一点,即查询发往/来自特定 JID 的所有消息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-04
    • 2014-09-22
    • 1970-01-01
    • 2014-07-14
    • 1970-01-01
    • 1970-01-01
    • 2012-04-25
    相关资源
    最近更新 更多