java - 解析 getCurrentUser 信息未更新

标签 java android parse-platform

对不起,如果这是一个愚蠢的问题,但这真的让我很生气。

if (ParseUser.getCurrentUser().getList("isFollowing") == null) {

        List<String> emptyList = new ArrayList<String>();
        ParseUser.getCurrentUser().put("isFollowing", emptyList);
    }

上面代码中的问题是它只在我第一次运行应用程序时返回 null,即使我再次将其设为 null。

这个问题在我的代码中无处不在,getCurrentUser 方法从不返回最新信息...

我认为问题在于 getCurrentUser 方法返回数据的缓存版本。如何更新?

我正在使用 parse 1.13.0bolts tasks 1.3.0

编辑: 现在我知道当我使用 ParseUser.getCurrentUser().saveInBackground();

时一切都搞砸了

这有帮助吗?

编辑 2: 问题似乎出在以下代码中的 saveInBackground() 方法中:

ParseUser.getCurrentUser().getList("isFollowing").add(users.get(
ParseUser.getCurrentUser().saveInBackground();

我第一次通过保存时运行良好,但第二次和其余的什么都不做......

我知道我现在很烦人,但我已经被这个问题困扰了大约 5 天......

请帮忙!

最佳答案

这是刷新当前用户的方式:

ParseUser.getCurrentUser().fetchInBackground(new GetCallback<ParseObject>() {
        @Override
        public void done(ParseObject object, ParseException e) {

        }
    });

关于java - 解析 getCurrentUser 信息未更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37837954/

相关文章:

java - 如何在 xml 声明标记处拆分格式不正确的 xml 文件,将其写入单独的 xml 文件中以解析它们?

java - 使用 JGoodies 绑定(bind)的只读绑定(bind)和单向转换器

php - 使用php将mp4文件上传到数据库

php - 使用大型数据集将 Parse JSON 输出转换为 CSV

javascript - Bootstrap.js 抛出选择器选项错误 : selector option must be specified when initializing tooltip on the windows. 文档对象

JAVA类型转换

android - 重复动画时更改图像

android - 重新将服务附加到 Activity ?

ios - 通过连接表解析查找

java - 与示例 Android Activity 建立解析连接。错误:Execution failed for task ':app:dexDebug'