2016-11-09 244 views
1

我使用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()); 

的鏈路由完成「/」

如所觀察到有錯誤,同時從parse到的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

這意味着您的JSON格式無效。 – sasikumar

+0

檢查你的json網址是否有效? http://jsonlint.com/ – sasikumar

+0

實際上,轉換JSON將由解析SDK完成,沒有我的代碼部分進去了。它最初的工作原理很好。幾天後我沒有。 – livemaker

回答

0

最後通過在db中創建一個具有相同結構和不同名稱的新表來解決這個問題。

現在沒有問題工作正常。