我在我的应用中使用quickblox
我正在尝试检索包含特定用户ID的对话框
NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
[dict setObject:@"occupants_ids" forKey:@[@([[[DataManager sharedCenter]chat_user]ID]), @(self.opponent.ID)]];
[QBChat dialogsWithExtendedRequest:dict delegate:self];
结果如下:
2014-08-09 13:47:02.843 App New[8752:8e0b] Performing async request:
GET https://api.quickblox.com/chat/Dialog.xml
headers:{
"QB-SDK" = "iOS 1.9.1";
"Qb-Token" = verylongtokencensored;
"QuickBlox-REST-API-Version" = "0.1.1";
}
parameters:{
(
1434093,
1367118
) = "occupants_ids";
}
2014-08-09 13:47:02.848 App New[8752:8e0b] Request finished, response:
headers:{
"Access-Control-Allow-Origin" = "*";
"Cache-Control" = "max-age=0, private, must-revalidate";
Connection = "keep-alive";
"Content-Type" = "application/xml; charset=utf-8";
Date = "Sat, 09 Aug 2014 10:47:02 GMT";
Etag = "\"0c1aa29ff51b425a9be969d4fbb487a1\"";
"QB-Token-ExpirationDate" = "2014-08-09 12:47:02 UTC";
"QuickBlox-REST-API-Version" = "0.1.1";
Server = "nginx/1.0.15";
Status = "201 Created";
"Transfer-Encoding" = Identity;
"X-Rack-Cache" = "invalidate, pass";
"X-Request-Id" = 2330d50ea8c08851cafd30ea4c1a1c6b;
"X-Runtime" = "0.022278";
"X-UA-Compatible" = "IE=Edge,chrome=1";
}
body:
<?xml version="1.0" encoding="UTF-8"?>
<session>
<_id>53e5fc26535c12a2f700aa3c</_id>
<application-id type="integer">10910</application-id>
<created-at type="datetime">2014-08-09T10:47:02Z</created-at>
<device-id type="integer">0</device-id>
<nonce type="integer">399</nonce>
<token>verylongtokencensored</token>
<ts type="integer">1407581207</ts>
<updated-at type="datetime">2014-08-09T10:47:02Z</updated-at>
<user-id type="integer">1434093</user-id>
<id type="integer">54616</id>
</session>
error:
2014-08-09 13:47:02.852 App New[8752:60b] received result:QBDialogsPagedResult,success:0,status:0
2014-08-09 13:47:02.852 App New[8752:8e0b] Request finished, response:
headers:(null)
body:
error:
2014-08-09 13:47:02.853 App New[8752:60b] Errors=(
"Connection closed due to timeout. Please check your internet connection."
)
如何解决此错误?
发送到api的其他请求,这不是/chat/Dialog.xml,它们工作正常,没有连接超时错误
答案 0 :(得分:0)
我的错误我的请求setObject forKey转过来,应该是
[dict setObject:@[@([[[DataManager sharedCenter]chat_user]ID]), @(self.opponent.ID)] forKey:@"occupants_ids" ];
答案 1 :(得分:0)
正确的方法是使用过滤器全部:
[dict setObject:@"33,55" forKey:@"occupants_ids[all]"];
这将找到所有对话框,其中occupants_ids =“33,55”
您还可以在:
中使用过滤器[dict setObject:@"33" forKey:@"occupants_ids[in]"];
这将返回 occupants_ids 包含33
的所有对话框