mercredi 26 août 2015

Parse.com pinInBackground ParseException

i'm using the following code to save an object and pin it to the local datastore:

final ParseObject testObject = new ParseObject("freunde");
ParseObject objspieler = ParseObject.createWithoutData("_User", ParseUser.getCurrentUser().getObjectId().toString());
ParseObject objfreund = ParseObject.createWithoutData("_User", id);
testObject.put("spielerid", objspieler);
testObject.put("freundid", objfreund);               
 testObject.saveInBackground(new SaveCallback() {
                    public void done(ParseException e) {
                        if (e == null) {
                            testObject.pinInBackground(new SaveCallback() {
                            @Override
                            public void done(ParseException e) {
                                if (e == null) {
                                    progress.dismiss();
                                    llfreunde.removeAllViews();
                                    getfriends(1);
                                } else {
                                    progress.dismiss();
                                    Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show();
                                }
                            }
                            });
                        } else {
                            Toast.makeText(getApplicationContext(), e.getMessage().toString(), Toast.LENGTH_LONG).show();
                        }
                    }
                });

after i run the code, pinInBackground throws following exception:

bolts.AggregateException: There were 3 exceptions.
android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: ParseObjects.className, ParseObjects.objectId (code 2067)

i've no idea how to fix this! thanks for any help! i'm using Parse 1.10.1

thanks

Aucun commentaire:

Enregistrer un commentaire