2013-03-16 3 views
1

XMPPFramework.I를 사용하여 iPhone에서 GroupChat을 달성하려면 어떻게해야합니까? 코드를 저장하려고했지만 방이 생성되지 않았습니다. 방이 생성되었는지 여부를 알 수 없습니까 .XMPPRoomDelegate는 호출되지 않습니다. 스트림 연결이 끊어지면 handleDidLeaveRoom 메서드가 호출됩니다.XMPPFramework - MultiUserChat 룸을 만드는 방법은 무엇입니까?

#define XMPP_HOSTNAME_2 @"chat.someservername.com" 
#define XMPP_JID   @"[email protected]" 
#define XMPP_PASSWORD @"venkat" 
#define ROOM_JID   @"[email protected]/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

inadvance 와요 고마워요 당신은 당신의 대리자 메서드를 게시시겠습니까? 또한 스트림에 대한 로깅을 설정하고 출력을 게시 하시겠습니까? 'main()'표준을'UIApplicationMain'과 함께 사용하고 있습니까? – paulmelnikow

답변

1
[self ConfigureNewRoom]; 

XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init]; 

XMPPRoom *xmppRoom1 = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage jid:[XMPPJID jidWithString:@"[email protected]"] 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]; 
+0

어떻게 여러 대화방을 활성화하고 위임 할 수 있습니까? –