12

After calling code below for several times(5-10 times), done() method for SaveCallback doesn't fire and whole application seems to stuck. It seems that this request ruins request queue and all further queries doesn't fire their callbacks either. No errors in callbacks and in logs. " BEFORE SAVING" - displayed in logs, while " SAVED" - didn't.

Do I need to change parse pricing contract, or to change my code somehow?

    Log.d("MESSAGE OBJECT", " BEFORE SAVING");
    messageParseObject.saveInBackground(new SaveCallback() {
        @Override
        public void done(final ParseException e) {
            Log.d("MESSAGE OBJECT", " SAVED");
            if (e != null){
                completitionCallback.error(e);
                return;
            }

            chatObject.put(ModelConstants.LAST_MESSAGE_KEY, messageParseObject);
            chatObject.getRelation(ModelConstants.MESSAGES_KEY).add(messageParseObject);                
            chatObject.saveInBackground(new SaveCallback() {
                @Override
                public void done(ParseException e) {
                    Log.d("CHAT OBJECT", " SAVED");
                    if (e == null)
                        completitionCallback.success();
                    else
                        completitionCallback.error(e);
                }
            });
        }
    });
PaulKh
  • 161
  • 1
  • 6
  • What is messageParseObject? p.s. usually it is not regular thing to call 'saveInBackground' inside another one. May be this is a cause of the problem. – Volodymyr Lykhonis Jul 22 '14 at 20:41
  • @VladimirLichonos messageParseObject is of type ParseObject, it has array and pointer to message creator. In first _saveInBackground_ I save message of the chat, in the next one I update my chat Object(adding message to relation). So first I need to save message, and after it has been saved I update chatObject. – PaulKh Jul 23 '14 at 07:41

1 Answers1

12

Faced this and really drove me crazy. This is what I found. If the Class is already created in Parse.com, even if there is a small discrepancy saveInBackground and saveEventually fails without any error.

Best way, if this happens is to delete the created class in Parse.com and let the android SDK call it it automatically in the first invocation.

At least that did the trick for me.

sivag1
  • 4,734
  • 3
  • 32
  • 35
  • This was actually the problem I had. I thought that ParseObject.create() would always create a new object (e.g. with a new object Id), but apparantly these have to be unique at least by one column – Entreco Jan 15 '15 at 10:24
  • Just fixed the same issue by simply renaming the name of my Class within android as I cannot afford to loose my data. Can anyone confirm whether a bug has been raised for the parse dev team?? Is a serious issue in my mind as it completely breaks functionality, atleast getting an error in the callback would be more acceptable. – cYrixmorten Oct 12 '15 at 11:45
  • 1
    This should be reported as bug? Right? I have been trying to figure this one out for the past 2 hours, and I guess lots of people might have had the same issue. – capt.swag Jan 01 '16 at 14:12
  • Any better way of dealing with this? After I call item.deleteEventually on a list, which I then to save to Parse using saveInBackground, I get the same problem. Has anyone figured out a solution that doesn't require manual parse editing? – Jonathan Dunn Feb 24 '17 at 22:37