我想将以下IQ发送到开放式服务器:
<iq type="get">
<regdata xmlns="abc">
<username>cooper</username>
<emailid>cooper@hotmail.com</emailid>
<password>cooperpass</password>
<dob>11-12-1979</dob>
<gender>male</gender>
</regdata>
</iq>
Xcode中的命令是什么?
我正在使用下面提到的脚本,但它不起作用。
NSXMLElement *regdata = [NSXMLElement elementWithName:@"regdata" xmlns:@"abc"];
NSXMLElement *iq = [NSXMLElement elementWithName:@"iq"];
XMPPJID *myJID = self.xmppStream.myJID;
[iq addAttributeWithName:@"type" stringValue:@"get"];
[iq addAttributeWithName:@"from" stringValue:myJID.description];
[iq addAttributeWithName:@"to" stringValue:myJID.domain];
[iq addAttributeWithName:@"username" stringValue:txtName.text];
[iq addAttributeWithName:@"emailid" stringValue:txtEmail.text];
[iq addAttributeWithName:@"password" stringValue:txtPassword.text];
[iq addAttributeWithName:@"dob" stringValue:txtDOB.text];
[iq addAttributeWithName:@"gender" stringValue:txtGender.text];
[iq addChild:regdata];
[self.xmppStream sendElement:iq];