简体   繁体   English

Parse.com查询在数据浏览器中返回0结果我可以看到有2个结果

[英]Parse.com query returning 0 results when in the Data browser I can see there are 2 results

I am using Parse in my android application, and I and doing the following basic query: 我在我的android应用程序中使用Parse ,并且我执行以下基本查询:

    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();

the output I get is : Text 0 我得到的输出是: 文本0

That is really weird! 这真是太奇怪了! because I can definitively see in the Parse data browser that 2 results exist! 因为我可以在Parse数据浏览器中明确看到存在2个结果! Could this be something with ACL or whatever? 这可能是ACL或其他什么?

Here is a picture of my parse Data browser 这是我的解析数据浏览器的图片

在此输入图像描述

As you can see, there are 2 records that exist.. Note I have no idea what ACL is so that might be the problem.. 正如您所看到的,存在2条记录。注意我不知道ACL是什么,这可能是问题..

Most likely its the undefined ACL causing your access problem ( entity in back end not being retreived by a GET ). 很可能是未定义的ACL导致您的访问问题(后端实体未被GET检索)。

So, you should read the section of the android manual on ACL and on security. 所以,你应该阅读有关ACL和安全性的android手册部分。 As a starter, when you create an object , you should construct an ACL with READ&WRITE for the owner and READ for others... 作为入门者,当你创建一个对象时,你应该为所有者构建一个带有READ&WRITE的ACL,为其他人构建READ ......

In android granting either world read/write or exclusive read/write to owner , that would be : 在android中授予对所有者的世界读/写或独占读/写,这将是:

                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);

For ACL example in JS , see createOnEnter method in the link 对于JS中的ACL示例,请参阅链接中的createOnEnter方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM