2016-09-26 4 views
0

나는 클래스를 따르고 있으며 Parsing API와 함께 Heroku 앱을 사용하여 데이터를 데이터베이스에 삽입합니다. 비디오에서 강사의 코드는 제대로 작동하지만 이중 확인시 데이터베이스에 "저장 실패"및 데이터가 계속 표시됩니다. 아무도 내가 뭘 잘못 알고 있을까요?데이터를 구문 분석에 삽입하는 방법?

package com.parse.starter; 

import android.app.Application; 
import android.util.Log; 

import com.parse.Parse; 
import com.parse.ParseACL; 
import com.parse.ParseException; 
import com.parse.ParseObject; 
import com.parse.ParseUser; 
import com.parse.SaveCallback; 


public class StarterApplication extends Application { 

    @Override 
    public void onCreate() { 
    super.onCreate(); 

    // Enable Local Datastore. 
    Parse.enableLocalDatastore(this); 

    // Add your initialization code here 
    Parse.initialize(new Parse.Configuration.Builder(this) 
      .applicationId("sdfsdkf34390") 
      .clientKey(null) 
      .server("http://instagramtrynumber3.herokuapp.com/parse") 
    .build() 
    ); 

    ParseObject gameScore = new ParseObject("GameScore"); 
    gameScore.put("score", 1337); 
    gameScore.put("playerName", "Sean Plott"); 
    gameScore.put("cheatMode", false); 
    gameScore.saveInBackground(new SaveCallback() { 
     public void done(ParseException e) { 
      if (e == null) { 
       Log.i("Parse", "Save Succeeded"); 
      } else { 
       Log.i("Parse", "Save Failed"); 
      } 
     } 
    }); 


    ParseUser.enableAutomaticUser(); 
    ParseACL defaultACL = new ParseACL(); 
    // Optionally enable public read access. 
    // defaultACL.setPublicReadAccess(true); 
    ParseACL.setDefaultACL(defaultACL, true); 
    } 
} 

답변

0

좋아요 ... 나는 결국 답을 찾았습니다. .server 부분을 채울 때, 그것이 (예 : .server(http://instagramtrynumber3.herokuapp.com/parse/과 같이 URL 끝에 "/"가 있는지 확인하는 것이 사소하고 어리석은 것처럼 보일 수도 있지만).

관련 문제