Reputation: 212
I can't get the unpinning to work and can't find a solution. I pin the data this way:
myGroup = queryGroup.getFirst();
if (myGroup != null) {
ParseObject.unpinAllInBackground("Groups", new DeleteCallback() {
@Override
public void done(ParseException arg0) {
myGroup.pinInBackground("Groups", new SaveCallback() {
@Override
public void done(ParseException arg0) {
if (arg0 != null) {
Toast.makeText(getApplicationContext(), "ERROR", Toast.LENGTH_SHORT).show();
arg0.printStackTrace();
}
}
});
}
});
}
and try to unpin it like this:
ParseObject.unpinAllInBackground("Groups", new DeleteCallback() {
@Override
public void done(ParseException arg0) {
if (arg0 == null) {
dataDeleted();
} else {
arg0.printStackTrace();
}
}
});
But it doesn't throw an exception and the data is still saved locally when I start a query.
Upvotes: 7
Views: 1465
Reputation: 1244
try deleting your local data and try again. I had some weird issues related to pinning, turned out I had objects pinned with no data in them, which messed up the pinning.
Using the following code, pinallinbackground works, are you able to try that instead of iterating through each object?:
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(final List<ParseObject> moves, final com.parse.ParseException e) {
if (e == null) {
if (debug) {
Log.i("bjjMoves returned:", String.valueOf(moves.size()));
}
ParseObject.unpinAllInBackground("bjjMoves", new DeleteCallback() {
public void done(ParseException e) {
// Cache the new results.
ParseObject.pinAllInBackground("BJJMove", moves);
}
});
you'll notice I'm using PinAllInBackground, not pininbackground.
Upvotes: 1