Thread 4 | __54-[AVPaasClient goRequest:saveResult:block:retryTimes:]blockinvoke380 [Line 543]
Error (0.252s)
Error Domain=AVNetworkingErrorDomain Code=-1011 "Expected status code in (200-299), got 401" UserInfo=0x17ec9990 {NSLocalizedRecoverySuggestion={"code":401,"error":"Unauthorized."}, NSErrorFailingURLKey=https://api.leancloud.cn/1.1/cloudQuery?cql=select%20*%20from%20LMQuestion, NSLocalizedDescription=Expected status code in (200-299), got 401, AVNetworkingOperationFailingURLRequestErrorKey= { URL: https://api.leancloud.cn/1.1/cloudQuery?cql=select%20*%20from%20LMQuestion1 }, AVNetworkingOperationFailingURLResponseErrorKey=2015-06-08 16:32:05.740 zhihuamu[606:60b] results:(null)
{ URL: https://api.leancloud.cn/1.1/cloudQuery?cql=select%20*%20from%20LMQuestion1 } { status code: 401, headers {
"Cache-Control" = "no-cache,no-store";
Connection = "keep-alive";
"Content-Length" = 36;
"Content-Type" = "application/json;charset=utf-8";
Date = "Mon, 08 Jun 2015 08:36:03 GMT";
Pragma = "no-cache";
Server = Tengine;
} }}
08:32:05.0729 Thread 4 | +[AVErrorUtils errorFromJSON:] [Line 192] error: Error Domain=AVOS Cloud Error Domain Code=401 "Unauthorized." UserInfo=0x17db48b0 {NSLocalizedDescription=Unauthorized., code=401, error=Unauthorized.}

这个没有人回答么?我也遇到这个问题了。iOS8查询正常,iOS7不能查询。

这与 OS 版本应该是无关的,麻烦你将请求的 cURL 日志发出来看看。

打开日志可以通过 [AVOSCloud setAllLogsEnabled:YES]; 接口实现,放在 AVOSCloud 初始化语句后面。

------ BEGIN LeanCloud REST Response ------
path: /1.1/classes/btccomexplorertest
cost: 3.893s
response: Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: 未经授权 (401)" UserInfo=0xa0a1770 {com.alamofire.serialization.response.error.response= { URL: https://api.leancloud.cn/1.1/classes/btccomexplorertest?where=%7B%22IDFA%22%3A%7B%22%24gte%22%3A%22A356E5D5-4432-4B0D-9D83-53275B41EBEB%22%7D%7D } { status code: 401, headers {
Server = Tengine,
Content-Type = application/json;charset=utf-8,
Content-Length = 36,
Connection = keep-alive,
Date = Wed, 21 Dec 2016 10:02:55 GMT,
Cache-Control = no-cache,no-store,
Pragma = no-cache
} }, NSErrorFailingURLKey=https://api.leancloud.cn/1.1/classes/btccomexplorertest?where=%7B%22IDFA%22%3A%7B%22%24gte%22%3A%22A356E5D5-4432-4B0D-9D83-53275B41EBEB%22%7D%7D, NSLocalizedDescription=Request failed: 未经授权 (401), com.alamofire.serialization.response.error.data=<7b22636f 6465223a 3430312c 22657272 6f72223a 22556e61 7574686f 72697a65 642e227d>}
------ END --------------------------------
iOS7查询的时候总是授权有问题返回401