我使用以下code
来阻止群组用户,但它为我提供了error
。
以下是我保持QBPrivacyList
阻止它的逻辑,但我没有成功。
-(void)ViewDidLoad{
[[QBChat instance] addDelegate:self];
[[QBChat instance] retrievePrivacyListWithName:@"group_public"];
}
- (void)chatDidReceivePrivacyList:(QBPrivacyList *)privacyList{
[SVProgressHUD dismiss];
blockPrivacyList = privacyList;
[[QBChat instance] setActivePrivacyListWithName:blockPrivacyList.name];
}
-(IBAction)blockGroupUser{
QBPrivacyItem *item = [[QBPrivacyItem alloc] initWithType:GROUP valueForType:user.ID action:DENY];
if (blockPrivacyList) {
[blockPrivacyList addObject:item]; // add new user if already privacy list is there
}else
blockPrivacyList= [[QBPrivacyList alloc] initWithName:@"group_public" items:@[item]];
}
[[QBChat instance] setPrivacyList:blockPrivacyList];
}
得到以下错误:
<iq xmlns="jabber:client" id="9C79DCE1-AC59-4C9D-8AB2-BE2387B1EED4" to="5554981-24659@chat.quickblox.com/D060E713-F1DC-46D7-A2BF-8DA7BDB22CBA" type="error"><query xmlns="jabber:iq:privacy"><list name="group_public"><item action="deny" order="5291124" value="5291124-24659@chat.quickblox.com" type="group"><iq/><message/><presence-in/><presence-out/></item></list></query><error type="cancel" code="404"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></iq>
答案 0 :(得分:1)
尝试在编辑后激活您的隐私列表
http://quickblox.com/developers/SimpleSample-chat_users-ios#Activate_a_privacy_list
-(IBAction)blockGroupUser{
QBPrivacyItem *item = [[QBPrivacyItem alloc] initWithType:GROUP valueForType:user.ID action:DENY];
if (blockPrivacyList) {
[blockPrivacyList addObject:item]; // add new user if already privacy list is there
}else
blockPrivacyList= [[QBPrivacyList alloc] initWithName:@"group_public" items:@[item]];
}
[[QBChat instance] setPrivacyList:blockPrivacyList];
}
- (void)chatDidSetPrivacyListWithName:(NSString *)name{
[[QBChat instance] setDefaultPrivacyListWithName:@"public"];
[[QBChat instance] setActivePrivacyListWithName:@"public"];
}
- (void)chatDidSetDefaultPrivacyListWithName:(NSString *)name{
}
- (void)chatDidNotSetDefaultPrivacyListWithName:(NSString *)name error:(id)error{
}
- (void)chatDidSetActivePrivacyListWithName:(NSString *)name{
}
- (void)chatDidNotSetActivePrivacyListWithName:(NSString *)name error: (id)error{
}