Parse.com查询返回0的结果,当在数据浏览器中,我可以看到有2个结果 [英] Parse.com query returning 0 results when in the Data browser I can see there are 2 results
问题描述
我使用的解析在我的Android应用程序,而我,做了以下基本的查询:
I am using Parse in my android application, and I and doing the following basic query:
List<ParseObject> activityList = null;
ParseQuery<ParseObject> query = ParseQuery.getQuery("Activity");
query.setLimit(10);
try {
activityList = query.find();
} catch (ParseException e) {
e.printStackTrace();
}
Toast.makeText(Main.this, "Test "+activityList.size(), Toast.LENGTH_LONG).show();
我得到的输出是:的文字0
这是很奇怪的!因为我可以在分析数据浏览器2的结果存在明确看到!难道这是一些与 ACL 或什么?
That is really weird! because I can definitively see in the Parse data browser that 2 results exist! Could this be something with ACL or whatever?
下面是我解析的照片数据浏览器
正如你所看到的,有2条是存在的。注意,我不知道什么样的 ACL 是这样,可能是这个问题。
As you can see, there are 2 records that exist.. Note I have no idea what ACL is so that might be the problem..
推荐答案
最有可能的导致您的访问问题(实体后端没有retreived由GET)中定义的ACL。
Most likely its the undefined ACL causing your access problem ( entity in back end not being retreived by a GET ).
所以,你应该阅读的Android手册的部分对ACL和安全性。作为首发,当你创建一个对象,你应该构建一个访问控制列表与读取和放大器;写的所有者和阅读其他人...
So, you should read the section of the android manual on ACL and on security. As a starter, when you create an object , you should construct an ACL with READ&WRITE for the owner and READ for others...
在安卓批准或者世界读/写或独占读/写主人,这将是:
In android granting either world read/write or exclusive read/write to owner , that would be :
aclOb1 = new ObjectMapper().createObjectNode();
aclOb2 = new ObjectMapper().createObjectNode();
aclOb2.put("read", true);
aclOb2.put("write", true);
String oid = $Get.current.user
if(oid.equalsIgnoreCase("default")){
aclOb1.put("*", aclOb2);
}else{
aclOb1.put(oid, aclOb2);
}
rootOb.put("ACL", aclOb1);
对于JS ACL示例,请参见 createOnEnter方法< /一>中的链接
For ACL example in JS , see createOnEnter method in the link
这篇关于Parse.com查询返回0的结果,当在数据浏览器中,我可以看到有2个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!