w/system.err:com.parse.parserequest$parserequestexception:tweet.amitabh的模式不匹配;应为数组,但得到字符串

ejk8hzay  于 2021-06-29  发布在  Java
关注(0)|答案(0)|浏览(166)

这是用于更新键“amithabh”的值的代码,但是 put 方法出错。这个 add 以及 remove 方法工作正常。服务器连接良好

package com.example.androidparse;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseInstallation;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.SaveCallback;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ParseQuery<ParseObject> query = ParseQuery.getQuery("Tweet");
        query.getInBackground("qDGilscXDH", new GetCallback<ParseObject>() {
            @Override
            public void done(ParseObject object, ParseException e) {
                if(e == null){
//                    object.add("Amitabh","KBC");
                    object.put("Amitabh","kbc");
                    object.saveInBackground(new SaveCallback() {
                        @Override
                        public void done(ParseException e) {
                            e.printStackTrace();
                        }
                    });

                    Log.i("string",object.get("Amitabh").toString());
                    Log.i("success","saved succesfull");
                }else{
                    Log.i("not saved",e.getStackTrace().toString());
                }
            }
        });

        ParseInstallation.getCurrentInstallation().saveInBackground();
    }
}

在解析服务器上更新值的代码
输出错误

W/System.err: com.parse.ParseRequest$ParseRequestException: schema mismatch for Tweet.Amitabh; expected Array but got String
W/System.err:     at com.parse.ParseRequest.newPermanentException(ParseRequest.java:268)
        at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:302)
        at com.parse.ParseRequest$3.then(ParseRequest.java:134)
W/System.err:     at com.parse.ParseRequest$3.then(ParseRequest.java:130)
        at com.parse.boltsinternal.Task$15.run(Task.java:907)
        at com.parse.boltsinternal.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:113)
W/System.err:     at com.parse.boltsinternal.Task.completeAfterTask(Task.java:898)
        at com.parse.boltsinternal.Task.continueWithTask(Task.java:713)
        at com.parse.boltsinternal.Task.continueWithTask(Task.java:724)
W/System.err:     at com.parse.boltsinternal.Task$13.then(Task.java:816)
        at com.parse.boltsinternal.Task$13.then(Task.java:804)
W/System.err:     at com.parse.boltsinternal.Task$15.run(Task.java:907)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)

错误输出

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题