Android系统。 Parse.com:数组没有更新

时间:2023-02-07 17:02:27

On every launch my app loads fresh data from parse.com and pins all objects to use app without network requests like this^

在每次启动时,我的应用程序都会从​​parse.com加载新数据并将所有对象固定为使用应用程序而不需要像这样的网络请求

 public void pinKids() {
    ParseQuery<ParseObject> query = ParseQuery.getQuery(ParseConstants.CLASS_KIDS);
    query.whereEqualTo(ParseConstants.KEY_PARENT, currentUser);
    query.findInBackground(new FindCallback<ParseObject>() {
        public void done(final List<ParseObject> kidsList, ParseException e) {
            if (e == null) {

                ParseObject.unpinAllInBackground(ParseConstants.LABEL_KIDS, new DeleteCallback() {
                    @Override
                    public void done(ParseException e) {
                        ParseObject.pinAllInBackground(ParseConstants.LABEL_KIDS, kidsList, new SaveCallback() {
                            @Override
                            public void done(ParseException e) {

                                Log.d("Hello", "pinKids");

                            }
                        });

                    }
                });

            }
        }
    });
}

One of the columns in my class is an array of strings (it stores history messages). I found that my code doesn't refresh this array if that array was updated from the other device (the same user did something on the other device). The rest of the data (other columns) refresh without problems. But the array of strings stays as it was downloaded at first launch.

我班级中的一列是一个字符串数组(它存储历史消息)。我发现我的代码不会刷新此数组,如果该数组是从其他设备更新的(同一用户在另一台设备上做了一些事情)。其余数据(其他列)刷新没有问题。但是在第一次启动时下载的字符串数组保持不变。

In parse.com dashboard I see that array is updated. But code doesn't download this array while all the other columns are downloaded correctly.

在parse.com仪表板中,我看到该阵列已更新。但是,在正确下载所有其他列时,代码不会下载此数组。

Let me say that when I update this array on device-1 the new data is stored on device-1 and on "parse.com" too. But it doesn't update on device-2.

让我说,当我在设备-1上更新此数组时,新数据也存储在设备-1和“parse.com”上。但它不会在设备-2上更新。

Please help!

1 个解决方案

#1


0  

OK! I've solved it.

好!我已经解决了。

This problem is a bug of parse.com.

这个问题是parse.com的一个bug。

I've created an issue on parse's github. So I found that my problem is a part of parse's bug.

我在parse的github上创建了一个问题。所以我发现我的问题是解析错误的一部分。

So the answer is: replace all calls to getJSONArray(key) with getList(key). You might also need revert()/revert(key)

所以答案是:用getList(key)替换对getJSONArray(key)的所有调用。您可能还需要revert()/ revert(key)

#1


0  

OK! I've solved it.

好!我已经解决了。

This problem is a bug of parse.com.

这个问题是parse.com的一个bug。

I've created an issue on parse's github. So I found that my problem is a part of parse's bug.

我在parse的github上创建了一个问题。所以我发现我的问题是解析错误的一部分。

So the answer is: replace all calls to getJSONArray(key) with getList(key). You might also need revert()/revert(key)

所以答案是:用getList(key)替换对getJSONArray(key)的所有调用。您可能还需要revert()/ revert(key)