XMPPFramework - “未授权”错误删除后,注册用户帐户(XMPPFramework -

2019-10-20 12:41发布

我想删除这是使用XMPP当前连接的用户的Openfire。

我用下面的代码删除用户:

- (void)DeleteAccountFromOpenfire
{
    NSXMLElement *query = [NSXMLElement elementWithName:@"query" xmlns:@"'jabber:iq:register'"];
    [query addChild:[NSXMLElement elementWithName:@"remove"]];
    XMPPIQ *iq = [XMPPIQ iqWithType:@"set" elementID:@"unreg1"];
    [iq addChild:query];
    [[self xmppStream] sendElement:iq];
}

但我得到一个not-authorized从服务器错误。 我怎么能避免呢?

Answer 1:

以下是解决删除注册用户从Openfire的帐户

NSXMLElement *query = [NSXMLElement elementWithName:@"query" xmlns:@"jabber:iq:register"];
[query addChild:[NSXMLElement elementWithName:@"remove"]];

NSXMLElement *iq = [NSXMLElement elementWithName:@"iq"];
[iq addAttributeWithName:@"type" stringValue:@"set"];
[iq addAttributeWithName:@"id" stringValue:@"unreg1"];
[iq addChild:query];
[[self xmppStream] sendElement:iq];


文章来源: XMPPFramework - “not-authorized” error upon deleting a registered user account