XMPP创建组未在iOS中获得响应

时间:2015-05-14 11:40:15

标签: ios objective-c xcode xmppframework muc

我尝试在iOS中使用XMPP Framework创建一个新组,使用以下代码按照给定here

NSString *nickName=[NSString stringWithFormat:@"%@.nickName@conference.server.hostname.in" ,newGroupName ];

XMPPRoomMemoryStorage * roomMemory = [[XMPPRoomMemoryStorage alloc]init];
NSString* roomID = [NSString stringWithFormat:@"%@@conference.server.hostname.in" ,newGroupName ];
XMPPJID * roomJID = [XMPPJID jidWithString:roomID];

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

[xmppRoom activate:self.xmppStream];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xmppRoom joinRoomUsingNickname:nickName history:nil password:nil];

我按照上面指定的thread

进行了配置
[xmppRoom fetchConfigurationForm];

但该方法没有回应

- (void)xmppRoomDidCreate:(XMPPRoom *)sender{
    DDLogVerbose(@"%@: %@", THIS_FILE, THIS_METHOD);
}

甚至不打电话都是这种方法。 这意味着该组未被创建,对吧? Log中没有显示错误或没有任何错误。

请告诉我我犯了什么错误,或者是否还有更多与此有关的事情。

提前致谢:D

1 个答案:

答案 0 :(得分:0)

以这种方式做到这一点。这是快速的

    let roomStorage: XMPPRoomMemoryStorage = XMPPRoomMemoryStorage()
    let roomJID: XMPPJID = XMPPJID.jidWithString("chatRoom10@conference.localhost")
    let xmppRoom: XMPPRoom = XMPPRoom(roomStorage: roomStorage,
        jid: roomJID,
        dispatchQueue: dispatch_get_main_queue())
    xmppRoom.activate(SKxmpp.manager().xmppStream)
    xmppRoom.addDelegate(self, delegateQueue: dispatch_get_main_queue())
    //xmppRoom.configureRoomUsingOptions(nil)
    xmppRoom.joinRoomUsingNickname(SKxmpp.manager().xmppStream.myJID.user, history: nil, password: nil)
    xmppRoom.fetchConfigurationForm()