2015-09-24 71 views
2

我正在使用以下code來阻止組用戶,但它給我error如何使用QuickBlox Ios框架阻止組中的用戶2.2

以下是我的邏輯維護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="[email protected]/D060E713-F1DC-46D7-A2BF-8DA7BDB22CBA" type="error"><query xmlns="jabber:iq:privacy"><list name="group_public"><item action="deny" order="5291124" value="[email protected]" 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>

回答

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{ 

}