查询代码:
AVQuery<AVObject> query = new AVQuery<>("Test");
query.findInBackground().subscribe(new Observer<List<AVObject>>() {
public void onSubscribe(Disposable disposable) {}
public void onNext(List<AVObject> students) {
// students 是包含满足条件的 Student 对象的数组
Log.d("----------------", students.size() + "onNest");
}
public void onError(Throwable throwable) {
Log.d("----------------", "onError..." + throwable.getMessage());
}
public void onComplete() {
Log.d("----------------", "onComplete");
}
});
返回结果:
2020-03-18 21:07:05.060 12217-12275/briefer.pet D/f: Request: curl -X GET
-H Accept: application/json
-H Content-Type: application/json
-H User-Agent: LeanCloud-Java-SDK/6.4.2
-H X-LC-Id: 2Vhp7hRwhTlNWlJ8tsdwoNLh-gzGzoHsz
-H X-LC-Prod: 1
-H X-LC-Session: {your_session}
-H X-LC-Sign: {your_sign}
https://api.palmpet.cn/1.1/classes/Test
2020-03-18 21:07:05.064 12217-12275/briefer.pet D/f: Response: 200
server: openresty
date: Wed, 18 Mar 2020 13:07:06 GMT
content-type: application/json;charset=utf-8
vary: Accept-Encoding
cache-control: no-cache,no-store
pragma: no-cache
last-modified: Wed, 18 Mar 2020 12:30:33.770 GMT
strict-transport-security: max-age=31536000
{"results":[{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T02:02:42.607Z","updatedAt":"2020-03-18T02:02:42.607Z","objectId":"5e7181422a6bfd0075971aad"},{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T02:03:40.295Z","updatedAt":"2020-03-18T02:03:40.295Z","objectId":"5e71817c91db2800774050dd"},{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T02:05:08.521Z","updatedAt":"2020-03-18T02:05:08.521Z","objectId":"5e7181d491db2800774059e6"},{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T02:09:03.291Z","updatedAt":"2020-03-18T02:09:03.291Z","objectId":"5e7182bf1358aa0074ae230b"},{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T02:17:37.757Z","updatedAt":"2020-03-18T02:17:37.757Z","objectId":"5e7184c18a84ab00772143ec"},{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T02:18:56.218Z","updatedAt":"2020-03-18T02:18:56.218Z","objectId":"5e718510fc36ed00761289a7"},{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T02:23:19.677Z","updatedAt":"2020-03-18T02:23:19.677Z","objectId":"5e7186171358aa0074ae53fc"},{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T02:34:05.318Z","updatedAt":"2020-03-18T02:34:05.318Z","objectId":"5e71889d2a6bfd0075978c8f"},{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T02:34:44.603Z","updatedAt":"2020-03-18T02:34:44.603Z","objectId":"5e7188c45620710075c2335d"},{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T07:21:04.156Z","updatedAt":"2020-03-18T07:21:04.156Z","objectId":"5e71cbe02a6bfd00759b9196"},{"content":"\u5468\u4e8c\u4e24\u70b9\uff0c\u5168\u4f53\u6210\u5458","title":"\u5de5\u7a0b\u5e08\u5468\u4f1a","createdAt":"2020-03-18T12:30:33.767Z","updatedAt":"2020-03-18T12:30:33.767Z","objectId":"5e72146991db28007748eca1"}]}
2020-03-18 21:07:05.098 12217-12217/briefer.pet D/----------------: onError...Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
日志有把列表返回了,但是为什么走onError,希望能得到回答,谢谢!!!