我的后端使用Parse DB,使用像Login,SaveInBackground,FindInBackGround这样的方法,大部分功能都在工作,除了,一个函数使用SaveInBackground(){....}其他方法与相同的SaveInBackground()工作正常
这是发生错误的方法
private void xxdatat(final ParseObject receiverObject) {
ParseObject obj = new ParseObject(Constants.XXX);
obj.put("SENDER_ID", objdata); //parse object type
obj.put("RECIEIVER_ID", Robjdata); //parse object type
obj.put("REQUEST_TYPE", stingdata); //String type
obj.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e==null) {
DialogUtil.showDialog(mContext, "working");
} else {
DialogUtil.showDialog(mContext,"Not working");
}
}
});
我浏览了互联网,并在解析配置文件中找到了一些解决方案。
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId(APP_ID)
.clientKey(CLIENT_KEY)
.addNetworkInterceptor(new ParseLogInterceptor())
.server("https://parse.xxxyyyzzz.com/parse/")
.build());
链接由“/”
完成正如所观察到的,将数据从解析转换为JSONObject时出现错误,异常也是JSONException。
如何解决这个问题?提前谢谢。
com.parse.ParseRequest$ParseRequestException: bad json response
at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:290)
at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:308)
at com.parse.ParseRequest$3.then(ParseRequest.java:137)
at com.parse.ParseRequest$3.then(ParseRequest.java:133)
at bolts.Task$15.run(Task.java:917)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:908)
at bolts.Task.continueWithTask(Task.java:715)
at bolts.Task.continueWithTask(Task.java:726)
at bolts.Task$13.then(Task.java:818)
at bolts.Task$13.then(Task.java:806)
at bolts.Task$15.run(Task.java:917)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: org.json.JSONException: Value <html> of type java.lang.String cannot be converted to JSONObject
at org.json.JSON.typeMismatch(JSON.java:111)
at org.json.JSONObject.<init>(JSONObject.java:160)
at org.json.JSONObject.<init>(JSONObject.java:173)
at com.parse.ParseRESTCommand.onResponseAsync(ParseRESTCommand.java:298)
at com.parse.ParseRequest$3.then(ParseRequest.java:137)
at com.parse.ParseRequest$3.then(ParseRequest.java:133)
at bolts.Task$15.run(Task.java:917)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:908)
at bolts.Task.continueWithTask(Task.java:715)
at bolts.Task.continueWithTask(Task.java:726)
at bolts.Task$13.then(Task.java:818)
at bolts.Task$13.then(Task.java:806)
at bolts.Task$15.run(Task.java:917)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
答案 0 :(得分:0)
最后通过在db中创建一个具有相同结构和不同名称的新表来解决这个问题。
现在没有问题可以解决。