【发布时间】:2014-07-21 06:27:45
【问题描述】:
在 Parse SDK 文档中,它声明固定指向另一个对象的对象,也将固定该目标对象:https://parse.com/docs/android_guide#localdatastore-pin
与保存一样,这递归地存储每个对象和文件 gameScore 指向,如果它是从云中获取的。每当 您保存对对象的更改,或从 Parse 获取新更改, 数据存储中的副本将自动更新,因此您无需 担心它。
但它没有说明的是,您以后如何取消固定第一个对象以及它指向的任何对象? (基本上是反向交易),以及从云端删除这些对象?
你愿意:
A.) 取消固定引用第一个对象的所有对象,然后使用 DeleteEventually 删除目标对象
或
B.) 首先取消固定所有对象,然后会自动删除目标对象?
另外,如果一个对象固定在数据存储中,但也保存到云中(从不取消固定),取消固定是否也会将其从云中删除?还是需要先取消固定然后删除,还是删除/取消固定?
编辑:
如果我理解 Fosco 的回复,我需要执行以下操作:
final ParseQuery<ParseObject> findMoves = ParseQuery.getQuery("bjjMatchMoves");
findMoves.fromPin("BJJMove");
findMoves.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(final List<ParseObject> moves, final com.parse.ParseException e) {
if (e == null) {
// First, unpin all objects that reference the main object, which should Remove the main object as well.
ParseObject.unpinAllInBackground("BJJMove", moves, new DeleteCallback() {
public void done(ParseException e) {
if (e != null) {
// There was some error.
return;
}
// objects have Now been unpinned. Now Delete them from the cloud
ParseObject.deleteAllInBackground(moves, new DeleteCallback() {
public void done(ParseException e) {
if (e != null) {
// There was some error.
return;
}
// objects have Now been unpinned and deleted, remove the main object from the cloud
}
});
}
});
}
}
});
【问题讨论】:
标签: android parse-platform pinning