2

当我发送创建房间的请求时,XMPP server(Openfire)401从服务器收到错误代码。以下是相同的日志:

"2013-09-03 09:47:56:298 ChatsIphone[7133:3e13] SEND:  type="get" to="test2@conference.shan.com" id="CD5FD987-039D-47D8-AF97-83212E68B14E">query xmlns="http://jabber.org/protocol/muc#owner"/>

2013-09-03 09:47:56:299 ChatsIphone[7133:4a0f] SEND: presence to="test2@conference.shan.com/iphone1">x xmlns="http://jabber.org/protocol/muc"><password>iphone1/password>/x>x xmlns="vcard-temp:x:update">photo/>/x>c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://code.google.com/p/xmppframework" ver="VyOFcFX6+YNmKssVXSBKGFP0BS4="/>/presence>

2013-09-03 09:47:56:358 ChatsIphone[7133:4a0f] RECV: iq xmlns="jabber:client" type="error" id="CD5FD987-039D-47D8-AF97-83212E68B14E" from="test2@conference.shan.com" to="iphone1@shan.com/7cffdf9">query xmlns="http://jabber.org/protocol/muc#owner"/>error code="401" type="auth">not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>/error>/iq>

而且我还可以看到我的房间已经创建。但我无法解决错误代码 401。任何人都可以让我知道这里有什么问题。

瓦兹

嗨亚当,

感谢您的回复,

请在下面找到代码,

使用以下代码成功创建房间,

XMPPJID *roomRealJid = [XMPPJID jidWithString:_userNameEdit.text];
XMPPRoom *newXmppRoom = [[XMPPRoom alloc] initWithRoomStorage:_appDelegate.xmppRoomStorage jid:roomRealJid dispatchQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)];
[newXmppRoom activate: _appDelegate.xmppStream];
[newXmppRoom fetchConfigurationForm];
[newXmppRoom addDelegate:_appDelegate delegateQueue:dispatch_get_main_queue()];
[newXmppRoom joinRoomUsingNickname:_appDelegate.xmppStream.myJID.user history:nil password:@"iphone1"];



- (void)xmppRoomDidCreate:(XMPPRoom *)sender
{
         [sender configureRoomUsingOptions:nil];
}

谢谢,瓦兹

4

0 回答 0