Facebook签到错误

时间:2013-02-14 09:06:35

标签: android facebook checkin

我正在使用以下代码在Facebook上使用android:

private void checkin(){
    String access_token = mPrefs.getString("access_token", null);
    Bundle params = new Bundle();
    params.putString("access_token", access_token);
    JSONObject place = new JSONObject();
    try {
        place.put("location", location.toString());
        place.put("name", name);
        place.put("id", id);
    } catch (JSONException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    Log.i("place", place.toString());
    params.putString("place", place.toString());  // YOUR PLACE ID
    params.putString("message","I m here in this place");
    JSONObject coordinates = new JSONObject();
    try {
        coordinates.put("latitude", Latitude);
        coordinates.put("longitude", Longitude);
    } catch (JSONException e) {
        e.printStackTrace();
    }

    params.putString("coordinates",coordinates.toString());
    params.putString("tags", "xxxx");//where xx indicates the User Id
    String response="";
    try {
        response = facebook.request("me/checkins", params, "POST");
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    Log.d("Response",response);
}

但在checkin期间我收到错误::

{"error":{"message":"(#114) An id must be a valid ID string (e.g., \"123\")","type":"OAuthException","code":114}}

这就是我获取地方详情的方式,其中页面网址是我的FB页面网址:

try {
        String response = facebook.request(pageURL);
        Log.i("Facebook Page Response ", response);
        JSONObject jobj = new JSONObject(response);
        location = new JSONObject(jobj.getString("location"));
        Latitude = location.getString("latitude");
        Longitude = location.getString("longitude");
        id = jobj.getString("id");
        name = jobj.getString("name");
        Log.i("Latitude", location.getString("latitude"));
        Log.i("Longitude", location.getString("longitude"));
        Log.i("id", jobj.getString("id"));
    } catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (JSONException e) {
        e.printStackTrace();
    }

请帮助我,我对使用Facebook api非常陌生。

1 个答案:

答案 0 :(得分:0)

抱歉,使用这种方法我真是太蠢了。它根据Facebook文档弃用。我无法删除这篇文章。遗憾。