Closed riteshpatel0 closed 6 years ago
@riteshpatel0, Hello.
print(listNames) // But we are getting same list for all
Could you explain in more detail the thing about "same list at all"?
From the documentation:
There are some rules you should follow to update a privacy list:
//Some updates here
//....
//Activating privacy list
QBChat.instance.setPrivacyList(privacyList)
QBChat.instance.setDefaultPrivacyListWithName("PrivacyList")
To get the privacy list by name you can use the following method:
QBChat.instance.retrievePrivacyList(withName: "PrivacyList")
If the privacy list is retrieved successfully the QBChat
instance will call its delegate’s chatDidReceivePrivacyList:
method:
func chatDidReceive(_ privacyList: QBPrivacyList) {
}
Otherwise the QBChat
instance will call its delegate’s chatDidNotReceivePrivacyListWithName:error:
method:
func chatDidNotReceivePrivacyList(withName name: String, error: Error) {
}
@riteshpatel0, Please check the updated answer.
hi @riteshpatel0, any updates?
Hello @pro100andrey ,
We are try your code. but it's not working.
we are perform the step like, first we block the user then we check the list but we are not getting any user. always call the below method.
func chatDidNotReceivePrivacyList(withName name: String, error: Error) {
}
is there any other way to check the user is block or unblock???
Thanks.
Hi @riteshpatel0, Could you please provide full logs with gist?
To enable full logs use the following code:
[QBSettings setLogLevel:QBLogLevelDebug];
[QBSettings enableXMPPLogging];
Thanks.
Hello @pro100andrey ,
Please check below logs,
<iq xmlns="jabber:client" to="50194435-70815@chat.quickblox.com/F7B66FBD-8CFC-416D-9408-48651959B778" id="F7D1B7F5-1FB5-4EC4-ACD0-C811C8BDC9C0" type="result"><query xmlns="jabber:iq:privacy"><list name="49643740"/><list name="50193652"/><default name="49643740"/></query></iq>
2018-05-23 15:50:21.256855+0530 HelpMeOut[1000:361245] [ChatService]: RCV: <iq xmlns="jabber:client" to="50194435-70815@chat.quickblox.com/F7B66FBD-8CFC-416D-9408-48651959B778" id="F7D1B7F5-1FB5-4EC4-ACD0-C811C8BDC9C0" type="result">
<query xmlns="jabber:iq:privacy">
<list name="49643740"/>
<list name="50193652"/>
<default name="49643740"/>
</query>
</iq>
Thanks.
@riteshpatel0, From your logs: You have two privacy lists with the following names:
<list name="49643740"/>
<list name="50193652"/>
List with name "49643740" is set as active.
But I haven't found the method call QBChat.instance.retrievePrivacyList(withName: "PrivacyList")
and error.
Please provide logs with the above error.
Hello @pro100andrey ,
Check below code logs with "retrievePrivacyList" method,
GET URL:https://api.quickblox.com/users/50193652.json
headers: {
"Accept-Language" = "en-IN;q=1";
"QB-OS" = "iOS 11.3.1";
"QB-SDK" = "iOS 2.15";
"QB-Token" = d9a9bf8a09a7a3c3b0c24a5ce4a7488e4901149f;
"QuickBlox-REST-API-Version" = "0.1.1";
"User-Agent" = "HelpMeOut/1.0 (iPhone; iOS 11.3.1; Scale/3.00)";
}
<iq type="get" id="6E3D89FE-EE98-40BE-BDEA-05CC5881435E"><query xmlns="jabber:iq:privacy"><list name="PrivacyList"/></query></iq>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2018-05-23 16:27:54.313863+0530 HelpMeOut[1021:375027] [ChatService]: SNT: <iq type="get" id="6E3D89FE-EE98-40BE-BDEA-05CC5881435E">
<query xmlns="jabber:iq:privacy">
<list name="PrivacyList"/>
</query>
</iq>
2018-05-23 16:27:54.500957+0530 HelpMeOut[1021:374921] -[QB_XMPPIQ domain]: unrecognized selector sent to instance 0x1c422f5a0
2018-05-23 16:27:54:497 HelpMeOut[1021:9207] RECV: <iq xmlns="jabber:client" to="50194435-70815@chat.quickblox.com/F7B66FBD-8CFC-416D-9408-48651959B778" id="6E3D89FE-EE98-40BE-BDEA-05CC5881435E" type="error"><query xmlns="jabber:iq:privacy"><list name="PrivacyList"/></query><error type="cancel" code="404"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" lang="en">Requested list not found.</text></error></iq>
2018-05-23 16:27:54.501375+0530 HelpMeOut[1021:375034] [ChatService]: RCV: <iq xmlns="jabber:client" to="50194435-70815@chat.quickblox.com/F7B66FBD-8CFC-416D-9408-48651959B778" id="6E3D89FE-EE98-40BE-BDEA-05CC5881435E" type="error">
<query xmlns="jabber:iq:privacy">
<list name="PrivacyList"/>
</query>
<error type="cancel" code="404">
<item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" lang="en">Requested list not found.</text>
</error>
</iq>
Thanks.
@riteshpatel0, please use the method QBChat.instance.retrievePrivacyList(withName: "<you privacy list name>")
with the name of your privacy list.
Hello @pro100andrey ,
what we need to pass in QBPrivacyList with name. we are passing "dialog.id" in let list: QBPrivacyList = QBPrivacyList(name: chatid, items: [item]) QBChat.instance.setDefaultPrivacyListWithName(chatid)
//Marks :- UnBlock methods let item: QBPrivacyItem = QBPrivacyItem(privacyType: QBPrivacyType.userID, userID: UInt(chatid)!, allow: true)! item.mutualBlock = true let list: QBPrivacyList = QBPrivacyList(name: chatid, items: [item]) QBChat.instance.setPrivacyList(list) QBChat.instance.setDefaultPrivacyListWithName(chatid)
Thanks.
@riteshpatel0, Hello. There is no need to create multiple privacy lists for separate dialogs. You can have only one privacy list and update it according to your needs:
Hello @VitaliyGuru ,
It's working.
Thanks.
Hello,
We are performing block-unblock user. it's working fine. but we are not getting updated privacy list.
we are use below snippet for fetching privacy list,
For block-unblock user we are using below snippet,
Thanks.