我如何使用XMPPFramework在iPhone中实现GroupChat。我尝试了暂停代码但是没有创建空间。我怎么知道是否创建了空间.XMPPRoomDelegate未被调用。当Stream断开连接时,handleDidLeaveRoom方法被调用。可以任何一个帮帮我。感谢inadvance
#define XMPP_HOSTNAME_2 @"chat.someservername.com"
#define XMPP_JID @"venkat@chat.someservername.com"
#define XMPP_PASSWORD @"venkat"
#define ROOM_JID @"venkat_muc@conference.chat.someservername.com/iMac"
- (void)mucSetupStream
{
xmppStream = [[XMPPStream alloc] init];
xmppStream.hostName = XMPP_HOSTNAME_2;
xmppStream.myJID = [XMPPJID jidWithString:XMPP_JID];
[xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()];
// Configure xmppRoom
XMPPJID *roomJID = [XMPPJID jidWithString:ROOM_JID];
xmppRoomStorage=[XMPPRoomCoreDataStorage sharedInstance];
xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:self jid:roomJID dispatchQueue:dispatch_get_current_queue()];
[xmppRoom activate:xmppStream];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
// Start connection process
NSError *err = nil;
if (![xmppStream connect:&err])
{
DDLogError(@"YapTesting: Cannot connect: %@", err);
}
[self performSelector:@selector(ConfigureNewRoom) withObject:nil afterDelay:5];
}
- (void)ConfigureNewRoom
{
NSLog(@"The Room is Configure After 5 Secs");
[xmppRoom fetchConfigurationForm];
[xmppRoom configureRoomUsingOptions:nil];
}
答案 0 :(得分:1)
[self ConfigureNewRoom];
XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPRoom *xmppRoom1 = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage jid:[XMPPJID jidWithString:@"Fun@conference.server.com"] dispatchQueue:dispatch_get_main_queue()];
[xmppRoom1 activate:[self xmppStream]];
[xmppRoom1 joinRoomUsingNickname:@"Fun" history:nil];
[xmppRoom1 addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xmppRoom1 fetchConfigurationForm];
[xmppRoom1 configureRoomUsingOptions:nil];