FB postId到期日有多长?

时间:2014-08-13 07:39:56

标签: android facebook facebook-graph-api facebook-like facebook-sdk-3.0

我写了一个android应用程序,它就像FB帖子一样做了FB。

我成功了,但很长一段时间后我得到了response

{
  Response:  responseCode: 400, 
  graphObject: null, 
  error: 
        {
         HttpStatus: 400, 
         errorCode: 100, 
         errorType: OAuthException, 
         errorMessage: (#100) Error finding the requested story
        },
 isFromCache:false
}

代码:

Request request = new Request(
        session,
        takeFromPublicMacrosOrServer(currentOffer.postId)
                + "/likes", null, HttpMethod.POST,
        new Request.Callback() {

            @Override
            public void onCompleted(Response response) {
                // Request complete
                if (response.getError() == null) {
                    UnlockRequestToServer unlockRequestToServer = new UnlockRequestToServer(
                            mOffersListActivity,
                            PublicMacros.TYPE_UNLOCK_FB_LIKE,
                            currentOffer.postId);

                } else {
                    final String errorMsg = "error: "
                            + response.getError()
                                    .toString();
                    Log.e(MyLogger.TAG, errorMsg);
                    if (BaseApplication
                            .getCurrentActivity() != null) {
                        BaseApplication
                                .getCurrentActivity()
                                .runOnUiThread(
                                        new Runnable() {
                                            public void run() {
                                                if (PublicMacros.DEBUG) {
                                                    Toast.makeText(
                                                            BaseApplication
                                                                    .getCurrentActivity(),
                                                            errorMsg,
                                                            Toast.LENGTH_LONG)
                                                            .show();
                                                }
                                            }
                                        });
                    }
                }
                String re = response.toString();
            }
        });
request.executeAsync();

有人知道postId有多长时间对FB有效吗?

1 个答案:

答案 0 :(得分:0)

How do I get a page Access Token that does not expire?可能包含一些有用的iformaion。

Facebook 3.0 How to post wall?告诉您如何发布到墙上

此问题向您展示了使用android的'like'Facebook like in android

修改

  

Facebook不会通知您之前发布的访问令牌   失效。除非你坚持到期时间传递给   您的应用程序以及访问令牌,您的应用程序可能只会学习a   当您尝试发出请求时,给定令牌已变为无效   到API。此外,响应某些事件   与安全相关的访问令牌可能在预期之前失效   到期时间。