Facebook FQL只能在开发者的帐户上运行

时间:2014-01-10 13:12:00

标签: android facebook-graph-api facebook-fql

代码只能在开发人员的Android应用程序上运行,该应用程序由开发人员的fb帐户记录 我不知道发生了什么事? 还有什么我需要设定的吗?

SELECT post_id,updated_time,message FROM stream WHERE source_id="+ userID +" and actor_id="+userID+" and type IN (46,66,80,128,247,257,285) LIMIT 120

但这可以运行..

"SELECT name,username, birthday_date,pic_square FROM user WHERE uid IN "
+ "(SELECT uid2 FROM friend WHERE uid1 = me())"

这是getData方法

public void GetDate(){


    String fqlQuery = "SELECT post_id,updated_time,message FROM stream WHERE source_id="+ userID +" and actor_id="+userID+" and type IN (46,66,80,128,247,257,285) LIMIT 120";      

    Bundle params = new Bundle();
    params.putString("q", fqlQuery);
    Session session = Session.getActiveSession();

    Request request = new Request(session, "/fql", params,HttpMethod.GET, new Request.Callback() {
        public void onCompleted(Response response) {
            try {
                GraphObject graphObject = response.getGraphObject();
                FacebookRequestError error = response.getError();
                if (graphObject != null) {
                    // Check if there is extra data
                    if (graphObject.getProperty("data") != null) {                         

                        JSONArray dataArray = new JSONArray(graphObject.getProperty("data").toString());

                        Log.e("JSONARRAY",graphObject.getProperty("data").toString());


                        for (int i = 0; i < dataArray.length(); i++) {
                            JSONObject dataObject = (JSONObject) dataArray.get(i);                          
                            String postID = dataObject.getString("post_id");
                            String postTime = dataObject.getString("updated_time");
                            String postMessage = dataObject.getString("message");
                            Log.e("postID",postID); 
                            Log.e("postTime",postTimev);
                            Log.e("postMessage",postMessage);
                        }                       
                    } else if (error != null) {
                    }
                }else{
                }
                //Log.e("Result: ", response.toString());
            } catch (Exception e) {
                e.printStackTrace();
            }

        }
    });
    Request.executeBatchAsync(request);
    finish();

}

我使用Facebook Developer Tool测试它,它可以工作.... 链接:https://developers.facebook.com/tools/explorer/


Permissions :(我已经完成)

  1. Facebook开发者Android页面上的所有步骤 - 入门指南
  2. https://developers.facebook.com/tools/explorer/
  3. 获取访问令牌

2 个答案:

答案 0 :(得分:0)

检查沙盒模式是打开还是关闭。使沙箱模式关闭。直到沙盒在您的应用程序上才对开发人员可见。在Facebook应用页面进行更改

答案 1 :(得分:0)

问题可能在于您执行查询的方式。在运行FQL之前,向我们展示您使用的代码以及如何进行身份验证。您是否还确保获得了所需的权限?