防止重复条目parse.com
  我使用Parse.com作为我的后端,而似乎有一个方法saveInBackgroundWithBlock ,以防止重复条目。  它似乎并不存在于Android上。  我只想上传唯一的条目,但无法找到一种方法。 
我能想到的唯一的事情就是查询,然后插入条目是否不存在,但这是网络呼叫的两倍,我觉得它需要。
谢谢
正如我在前面评论中提到的那样,我也遇到了同样的问题。 结束编写查询来查找现有对象,然后仅保存不存在的对象。 如下所示。
//假设你有一个ParseObjects列表,这个列表包含现有的和新的对象。
List<ParseObject> allObjects = new ArrayList<ParseObject>();
allObjects.add(object); //this contains the entire list of objects.
你想通过使用字段说ids找出现有的。
//First, form a query
ParseQuery<ParseObject> query = ParseQuery.getQuery("Class");
query.whereContainedIn("ids", allIds); //allIds is the list of ids
List<ParseObject> Objects = query.find();  //get the list of the parseobjects..findInBackground(Callback) whichever is suitable
for (int i = 0; i < Objects.size(); i++)
      existingIds.add(Objects.get(i).getString("ids"));
List<String> idsNotPresent = new ArrayList<String>(allIds);
idsNotPresent.removeAll(existingIds);
//Use a list of Array objects to store the non-existing objects
List<ParseObject> newObjects = new ArrayList<ParseObject>();
for (int i = 0; i < selectedFriends.size(); i++) {
     if (idsNotPresent.contains(allObjects.get(i).getString(
                        "ids"))) {
     newObjects.add(allObjects.get(i)); //new Objects will contain the list of only the ParseObjects which are new and are not existing.
    }
}
//Then use saveAllInBackground to store this objects
ParseObject.saveAllInBackground(newObjects, new SaveCallback() {
    @Override
    public void done(ParseException e) {
    // TODO Auto-generated method stub
    //do something
        }
    });
  我也曾尝试在ParseCloud上使用beforeSave方法。  如您所知,在保存对象之前,此方法在ParseCloud上调用,并且非常适合进行任何验证。  但是,它运行得并不顺利。  让我知道你是否需要ParseCloud代码中的某些东西。 
希望这可以帮助!
我不确定我是否理解你的问题,但是你可以在Android中获得与saveInBackgroundWithBlock相同的功能,如下所示: 
myObject.saveInBackground(new SaveCallback() {
    public void done(ParseException e) {
        if (e == null) {
           myObjectSavedSuccessfully();
        } else {
           myObjectSaveDidNotSucceed();
        }
    }
});
