unpinAllInBackground(List<...>, Delete Callback) 后对象仍在本地存储中

Objects still in localstore after unpinAllInBackground(List<...>, DeleteCallback)

我在 Android 应用程序中使用 Parse.com。我正在制作一个协作购物清单,允许用户标记要删除的项目(它们变成灰色),但只有当我按下“同步”按钮(并且有可用网络)时,它们才会真正被删除。目前,这些对象是从解析数据库中删除的,而不是从本地数据存储中删除的。我正在尝试这个:

 ParseQuery<ShoppingItem> queryDeletes = ShoppingItem.getQuery();
    queryDeletes.fromPin(MyApplication.ALL_ITEMS);
    queryDeletes.whereEqualTo("isDeleted", true);
    queryDeletes.findInBackground(new FindCallback<ShoppingItem>() {
        @Override
        public void done(final List<ShoppingItem> items, ParseException e) {
            if (e == null) {
                ShoppingItem.deleteAllInBackground(items, new DeleteCallback() {
                    @Override
                    public void done(ParseException e) {
                        if (e == null) {
                            ShoppingItem.unpinAllInBackground(items, new DeleteCallback() {
                                @Override
                                public void done(ParseException e) {
                                    if (e == null) {
                                        if (!isFinishing()) { 
                                           shoppingListAdapter.loadObjects(); // update the list view
                                        }
                                    }
                                }
                            });
                        }
                    }
                });
            }
        }
    });
}

已尝试清除应用程序数据并覆盖 ShoppingItem 中的 equals(),但没有成功。有什么想法吗?

谢谢!

好的,所以我解决了。据我了解,使用解析库无法实现我试图做的事情。

首先,deleteAllInBackground() 也取消固定对象,因此不需要 unpinAllInBackground()

问题是我使用 item.pin(MyApplication.ALL_ITEMS) 固定对象,因此取消固定对象的唯一方法是使用 item.unpinInBackground(MyApplication.ALL_ITEMS) 传递固定名称。但是,批处理版本不允许将项目集合和引脚名称作为参数传递。因此,无法使用命名的 pin 批量取消固定项目。

我最终取消了单独传递引脚名称的对象。我最大的抱怨是,在没有引脚名称的情况下执行 item.unpinInBackground() 不会引发异常,因此我不知道问题出在哪里。