当前,我正在进行聊天应用程序,并且我需要删除特定群组聊天。 对于删除组,我尝试使用以下解决方案,但无法正常工作。请检查此代码
-(void)ExitGroup:(NSString *)Roomjdi Removeuserid:(NSString *)Userid {
{
XMPPJID *roomJID = [XMPPJID jidWithString:Roomjdi];
XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];
XMPPRoom *xmppRooms = [[XMPPRoom alloc]
initWithRoomStorage:roomMemoryStorage
jid:roomJID
dispatchQueue:dispatch_get_main_queue()];
[xmppRooms removeDelegate:self delegateQueue:dispatch_get_main_queue()];
[self deactivate:roomJID];
[self leaveRoom:roomJID];
}
- (void)leaveRoom:(XMPPJID *)myRoomJID
{
// dispatch_block_t block = ^{ @autoreleasepool {
//XMPPLogTrace();
// <presence type='unavailable' to='darkcave@chat.shakespeare.lit/thirdwitch'/>
XMPPPresence *presence = [XMPPPresence presence];
[presence addAttributeWithName:@"to" stringValue:[myRoomJID full]];
[presence addAttributeWithName:@"type" stringValue:@"unavailable"];
[xmppStream sendElement:presence];
[xmppRoom leaveRoom];
[xmppRoom deactivate];
[xmppRoom removeDelegate:self];
}
我执行了此方法后,但是在组列表中已屏蔽的在线显示用户中。请告诉我我哪里错了。