无法使用xmpp接收群组消息

我无法收到此方法的群组消息。

- (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message
{
   NSLog(@"Message received description === %@",[message description]);
}

-(void)sendGroupMessage:(NSString *)NameOfGroup :(NSString *)Msg
{
    [xmppRoom sendMessageWithBody:Msg];
    NSXMLElement *x = [NSXMLElement elementWithName:NameOfGroup xmlns:XMPPMUCNamespace];

    XMPPMessage *message = [XMPPMessage message];
    [message addAttributeWithName:@"to" stringValue:[NSString stringWithFormat:@"%@",NameOfGroup]];
    [message addChild:x];
    NSLog(@"x in Invite === %@",x);
    [xmppRoom sendMessage:message];

}

-(void)setUpRoom:(NSString *)ChatRoomJID
{

    NSString *Strng=[NSString stringWithFormat:@"Abc@conference.localhost"];
    ChatRoomJID=Strng;
    XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];

    XMPPJID *roomJID = [XMPPJID jidWithString:ChatRoomJID];

    xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage jid:roomJID dispatchQueue:dispatch_get_main_queue()];

    [xmppRoom activate:xmppStream];
    [xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];


    [xmppRoom joinRoomUsingNickname:self.UserID
                            history:nil
                           password:nil];

    [self performSelector:@selector(ConfigureNewRoom:) withObject:nil afterDelay:4];

}

首先,我创建新组,发送邀请并成功接受所有受邀用户的邀请。 当我在该群组上发送消息时,所有人都成功获得了消息,但是如果我将停止应用并再次运行并使用xmpp登录并在群组上发送消息,则消息不会传送给已加入的用户。

当我必须注销并重新登录到xmpp服务器并发送消息在以前创建的组时,我收到了此错误消息

<message xmlns="jabber:client" from="dharmraj123@conference.localhost" to="revoz1wwbzji1e1481005747@localhost/1824017799289652742921131" type="error"><body>1 Message</body><error code="406" type="modify"><not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></not-acceptable><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Only occupants are allowed to send messages to the conference</text></error></message>
链接地址: http://www.djcxy.com/p/93531.html

上一篇: can't receive group message using xmpp

下一篇: Missing metadata in friend request for offline users