在墙上发布消息期间,android facebook 应用程序中的错误代码 3 未知方法

Posted

技术标签:

【中文标题】在墙上发布消息期间,android facebook 应用程序中的错误代码 3 未知方法【英文标题】:error code 3 unknown method in android facebook app during post message on wall 【发布时间】:2012-02-13 10:40:31 【问题描述】:

您好,我正在尝试使用此代码在墙上发布消息。

             Bundle params = new Bundle();
             params.putString(Facebook.TOKEN, facebook.getAccessToken());
             params.putString("message", "Facebook Dialogs are easy!");  
             AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
             mAsyncRunner.request(null, params, "POST", new SampleUploadListener(),null);

但是我收到了这个错误。

Response: "error_code":3,"error_msg":"Unknown method","request_args":["key":"message","value":"Facebook Dialogs are easy!","key":"method","value":"POST","key":"access_token","value":"AAAFby43GVwgBAJctMak5Y6IOaMylCWOFAXfXvsbMrckgZCi5wBZBSFWu02J1OY9ZB9aFLnwghHE72DgKe0YKIqctc5K54uyrA5mO5X2vQZDZD","key":"format","value":"json"]

谢谢兄弟..我试过了,但还是不行

             AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
             mAsyncRunner.request("Message Test", new SampleUploadListener());

这里又出现了错误...

GET URL:?https://graph.facebook.com/Message测试的access_token = AAAFby43GVwgBAJctMak5Y6IOaMylCWOFAXfXvsbMrckgZCi5wBZBSFWu02J1OY9ZB9aFLnwghHE72DgKe0YKIqctc5K54uyrA5mO5X2vQZDZD&格式= JSON 02-13 16:42:36.027:V /网页视图(13218):ZoomScale 3 mPreserveZoom:假02-13 16:42:37.085:d / Facebook-示例(13218):响应:400 错误请求

方法未实现

请求中的方法无效

02-13 16:42:37.085: W/Facebook-Example(13218): JSON 响应错误

【问题讨论】:

【参考方案1】:

见下面的代码

public class UpdateStatusResultDialog extends Dialog          private Bundle values;
private TextView mOutput, mUsefulTip;
private Button mViewPostButton, mDeletePostButton;
private Activity activity;
private Handler mHandler;

public UpdateStatusResultDialog(Activity activity, String title, Bundle values) 
    super(activity);
    this.activity = activity;
    this.values = values;
    setTitle(title);


@Override
protected void onCreate(Bundle savedInstanceState) 
    super.onCreate(savedInstanceState);

    mHandler = new Handler();

    setContentView(R.layout.update_post_response);
    LayoutParams params = getWindow().getAttributes();
    params.width = LayoutParams.FILL_PARENT;
    params.height = LayoutParams.FILL_PARENT;
    getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);

    mOutput = (TextView) findViewById(R.id.apiOutput);
    mOutput.setText(values.toString());

    mUsefulTip = (TextView) findViewById(R.id.usefulTip);
    mUsefulTip.setMovementMethod(LinkMovementMethod.getInstance());
    mViewPostButton = (Button) findViewById(R.id.view_post_button);
    mDeletePostButton = (Button) findViewById(R.id.delete_post_button);
    final String postId = values.getString("post_id");

    mViewPostButton.setOnClickListener(new View.OnClickListener() 
        @Override
        public void onClick(View v) 
            /*
             * Source tag: view_post_tag
             */
            Utility.mAsyncRunner.request(postId, new WallPostRequestListener());
        
    );
    mDeletePostButton.setOnClickListener(new View.OnClickListener() 
        @Override
        public void onClick(View v) 
            /*
             * Source tag: delete_post_tag
             */
            Utility.mAsyncRunner.request(postId, new Bundle(), "DELETE",
                    new WallPostDeleteListener(), null);
        
    );


public class WallPostRequestListener extends BaseRequestListener 

    @Override
    public void onComplete(final String response, final Object state) 
        try 
            JSONObject json = new JSONObject(response);
            setText(json.toString(2));
         catch (JSONException e) 
            setText(activity.getString(R.string.exception) + e.getMessage());
        
    

    public void onFacebookError(FacebookError error) 
        setText(activity.getString(R.string.facebook_error) + error.getMessage());
    


public class WallPostDeleteListener extends BaseRequestListener 

    @Override
    public void onComplete(final String response, final Object state) 
        if (response.equals("true")) 
            String message = "Wall Post deleted" + "\n";
            message += "Api Response: " + response;
            setText(message);
         else 
            setText("wall post could not be deleted");
        
    

    public void onFacebookError(FacebookError error) 
        setText(activity.getString(R.string.facebook_error) + error.getMessage());
    


public void setText(final String txt) 
    mHandler.post(new Runnable() 
        @Override
        public void run() 
            mOutput.setText(txt);
        
    );

【讨论】:

您好兄弟...感谢您的帮助..但仍然遇到问题,我已经编辑了问题。 github.com/facebook/facebook-android-sdk/tree/master/examples 转到此链接下载 Hackbook 的整个程序导入它并查看它包含所有功能链接上传图像或视频或更新状态等只是有一些错误但评论他们临时。它会正常工作 那太棒了...希望我能在早上得到链接:(

以上是关于在墙上发布消息期间,android facebook 应用程序中的错误代码 3 未知方法的主要内容,如果未能解决你的问题,请参考以下文章

如何以不同的人身份发布到 Facebook 墙上

在朋友墙上发布消息时出现集成错误?

如何在 iOS 的朋友墙上在 Facebook 上发布消息?

Facebook API在好友墙上发布消息

Android - 使用 facebook sdk 在 facebook 墙上发帖的问题

通过 Android 应用向 Facebook 好友发送消息