saveInBackground回调不工作 [英] saveInBackground callback doesn't work

查看:253
本文介绍了saveInBackground回调不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要求低于code数次(5-10次),完成后()方法SaveCallback不火和整个应用程序似乎卡住了。看来,这个请求废墟请求队列和所有其他的查询不火的试镜。在回调中,并在日志中没有错误。 在保存前 - 在日志中显示,而拯救 - 没有

我是否需要更改解析定价合同,或以某种方式改变我的code?

  Log.d(消息对象,在保存前);
    messageParseObject.saveInBackground(新SaveCallback(){
        @覆盖
        公共无效完成(最终ParseException的E){
            Log.d(消息对象,拯救);
            如果(E!= NULL){
                completitionCallback.error(E);
                返回;
            }

            chatObject.put(ModelConstants.LAST_MESSAGE_KEY,messageParseObject);
            chatObject.getRelation(ModelConstants.MESSAGES_KEY)。新增(messageParseObject);
            chatObject.saveInBackground(新SaveCallback(){
                @覆盖
                公共无效完成(ParseException的E){
                    Log.d(聊天对象,拯救);
                    如果(E == NULL)
                        completitionCallback.success();
                    其他
                        completitionCallback.error(E);
                }
            });
        }
    });
 

解决方案

面对这真的让我抓狂。这是我发现了什么。如果类是在Parse.com已经建立,即使有小的差异saveInBackground和saveEventually失败,没有任何错误。

最好的方式,如果发生这种情况是删除Parse.com创建类,并让Android SDK的自动调用它它在第一次调用。

至少这奏效了我。

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);
                }
            });
        }
    });

解决方案

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.

这篇关于saveInBackground回调不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆