0

我已经解决这个问题将近一个月了,但找不到答案。我有一个名为“shulMinyans”的 ParseRelation,我保存在名为“Shul”的 ParseObject 中。我在网上检查了 ParseRelation 是否正确保存并且保存得很好。当我尝试检索对象时,关系显示 ParseRelation 中没有已知对象。ParseObject 的所有其他数据都可以正常下载,但 ParseRelation 除外。这是我的代码:

    ParseUser userToSync = ParseUser.getCurrentUser();
    Shul shulForID = (Shul) userToSync.get("shul");
    String shulID = shulForID.getObjectId();
    ParseQuery<Shul> shulQuery = ParseQuery.getQuery("Shul");
    shulQuery.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ONLY);
    ArrayList<Minyan> oneArray = null;
    try {
        Shul shulToLoad = shulQuery.get(shulID);
        shulToLoad.loadShul(userToSync);
        ParseRelation shulMinyans = shulToLoad.getRelation("shulMinyans");
        ParseQuery query = shulMinyans.getQuery();
        try {
            oneArray = (ArrayList<Minyan>) query.find();
        } catch (ParseException e) {
            e.printStackTrace();
        }
    } catch (ParseException e) {
        e.printStackTrace();
    }

如何让 ParseRelation 检索我存储的数据?

4

1 回答 1

0

你能试试这个吗?

    ParseObject parseShul = ParseObject.createWithoutData("Shul", shulId);
    ParseRelation<ParseObject> relation = parseShul.getRelation("shulMinyans");
    ParseQuery<ParseObject> query = relation.getQuery();
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> list, ParseException e) {
            // Do something here
        }
    });
于 2015-08-30T11:41:24.210 回答