iOS XMPP 框架中的自定义 XMPP IQ [英] Custom XMPP IQ in iOS XMPP Framework

查看:24
本文介绍了iOS XMPP 框架中的自定义 XMPP IQ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to send custom IQ using xmpp framework in iOS for the following XML:

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

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

I used the below code in 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"> 部分时出现错误.请帮忙.

It is giving an error when I add group="abc"> part in DDXMLElement *query. Please help.

推荐答案

它使用以下代码工作:

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 框架中的自定义 XMPP IQ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆