Custom XMPP IQ in iOS XMPP Framework

我们两清 提交于 2019-12-08 08:03:39

问题


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>

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]);

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


回答1:


it worked by using the below code:

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];


来源:https://stackoverflow.com/questions/22804932/custom-xmpp-iq-in-ios-xmpp-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!